This repository has been archived by the owner. It is now read-only.

Depending on Microsoft.AspNetCore.Authentication 1.1.0 causes a failure to resolve System.Net.Http when targeting the full framework. #1046

Closed
jkells opened this Issue Nov 22, 2016 · 20 comments

Comments

Projects
None yet
@jkells
Copy link

jkells commented Nov 22, 2016

Depending on Microsoft.AspNetCore.Authentication 1.1.0 causes a failure to resolve System.Net.Http when targeting the full framework.

Minimal repro steps

I have attached a project that reproduces the issue.
SystemNetHttpClientIssue.zip

  1. Create a NetCore library project and NetCore console project targeting net46
  2. In the Library project depend on NetStandard.Library 1.6.1
  3. In the Library project make use of System.Net.Http
  4. In the console app, reference Microsoft.AspNetCore.Authentication 1.1.0
  5. In the console app reference and use the library project.

Expected result

The application should use System.Net.Http == 4.3.0 as defined in NetStandard 1.6.1 which correctly works on both the core and full framework.

Actual result

The application doesn't copy any System.Net.Http dll into the output folder.

The application will crash with FileNotFoundException: Could not load file or assembly 'System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

Further technical details

I believe this issue is related to a problem in the 4.1.0 version of the System.Net.Http package.
dotnet/corefx#9884
dotnet/corefx#9846

With the release of Asp.NET Core 1.1 the issue is fixed across all the packages I'm using except for this one. I believe it's related to this entry in your project.json file.

    "net451": {
      "frameworkAssemblies": {
        "System.Net.Http": ""
      }

Building a custom version of Microsoft.AspNetCore.Authentication without the dependency on "System.Net.Http" from the framework does fix the issue for me.

@RaviDesai

This comment has been minimized.

Copy link

RaviDesai commented Nov 22, 2016

I'm having this issue on a aspnetcore 1.1 app in VisualStudioCode (on my mac) targeting dotnet 5.6 and portable-net45+win8. Just upgraded this app from aspnetcore 1.0, where the reference to System.Net.Http worked fine.

"frameworks": {
    "netcoreapp1.1": {
      "dependencies": {
        "Microsoft.NETCore.App": {
          "version": "1.1.0",
          "type": "platform"
        }
      },
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

It sounds like you have some kind of work-around, but I'm not sure I understand it. Can you elaborate?

@Eilon

This comment has been minimized.

Copy link
Member

Eilon commented Nov 22, 2016

@anurse, @muratg will come talk to you about this.

@anurse

This comment has been minimized.

Copy link
Member

anurse commented Nov 23, 2016

This appears to be a packaging issue with our Authentication package. I've updated @muratg and @pranavkm with some information on it, and we'll investigate how best to fix this issue. Unfortunately I haven't been able to find a good workaround, short of downgrading back to net451 which should not exhibit this issue.

@Tratcher

This comment has been minimized.

Copy link
Member

Tratcher commented Nov 30, 2016

Yes, I was able to work around this in the given repro app by downgrading the Lib project from net46 to net452.

@SteveSandersonMS

This comment has been minimized.

Copy link
Member

SteveSandersonMS commented Dec 5, 2016

@anurse Might this also be the underlying cause for aspnet/JavaScriptServices#487? Please let me know if this is likely to be fixed in 1.1.1.

@anurse

This comment has been minimized.

Copy link
Member

anurse commented Dec 5, 2016

It certainly could be related. I don't know exactly what the plan is for fixing the issue in 1.1.1, since I've been OOF for a week, but in theory there are a few cases in our repositories where this issue could arise.

@Eilon

This comment has been minimized.

Copy link
Member

Eilon commented Jan 19, 2017

This patch bug is approved. Please use the normal code review process w/ a PR and make sure the fix is in the correct branch, then close the bug and mark it as done.

@Tratcher

This comment has been minimized.

Copy link
Member

Tratcher commented Jan 19, 2017

Note the frameworkAssemblies references were removed from dev as part of the xproj->csproj conversion. We only need to clean this up in the patch branches.

@sm-g

This comment has been minimized.

Copy link

sm-g commented Feb 3, 2017

@anurse your commit in rel/1.1.1 branch, does that mean that AspNetCore 1.1.1 nuget packages will contain it soon? If yes - when?

@Eilon

This comment has been minimized.

Copy link
Member

Eilon commented Feb 3, 2017

@sm-g we're working on the 1.1.1 release right now (obviously 😄 ) and we hope to have the official release out within 1 month.

@FelschR

This comment has been minimized.

Copy link

FelschR commented Feb 10, 2017

Is it right to assume that 1.1.1 will be published before/alongside VS2017's release in March?

@Tratcher

This comment has been minimized.

Copy link
Member

Tratcher commented Feb 10, 2017

@Eilon

This comment has been minimized.

Copy link
Member

Eilon commented Feb 10, 2017

@FelschR we're still figuring out the details on exactly when the two releases will go live, but it'll certainly be close!

@emirhosseini

This comment has been minimized.

Copy link

emirhosseini commented Feb 10, 2017

What do you mean by Asp.Net Core 1.1.1? There's no such NuGet package. There's "Microsoft.AspNetCore.Mvc" which is already on 1.1.1. Please clarify exactly what you're talking about.

@Tratcher

This comment has been minimized.

Copy link
Member

Tratcher commented Feb 10, 2017

@emirhosseini 1.1.1 is the version of the upcoming patch for this repo.

@marianosz

This comment has been minimized.

Copy link

marianosz commented Feb 14, 2017

When will be released?

@Eilon

This comment has been minimized.

Copy link
Member

Eilon commented Feb 14, 2017

@marianosz the plan is to have it out later this month. We're just nearly done with all the fixes, and we're working on getting the final builds put together and doing additional testing.

@marianosz

This comment has been minimized.

Copy link

marianosz commented Feb 14, 2017

Thanks for the info!

@marianosz

This comment has been minimized.

Copy link

marianosz commented May 11, 2017

I'm still facing the same issue with all the packages updated using net462... Any workarounds?

@Maritims

This comment has been minimized.

Copy link

Maritims commented Jun 29, 2017

I am also experiencing this issue with everything updated and running net461

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.