Description
See dotnet/core#730 (comment).
Related: https://github.com/dotnet/corefx/issues/19058
The netstandard mapping for net461
changed from netstandard1.4
to netstandard2.0
and NET462 changed from netstandard1.5
to netstandard2.0
.
This causes a ref-def mismatch for our old packages, consider System.Runtime:
- netstandard1.0 : 4.0.0.0
- netstandard1.2 : 4.0.10.0
- netstandard1.3 : 4.0.20.0
- netstandard1.5 : 4.1.0.0
- net45 : 4.0.0.0
- net451 : 4.0.10.0
- net46 : 4.0.20.0
- net462 : 4.1.0.0
A library compiled against netstandard1.5
would get a reference to assembly version 4.1.0.0. Prior to the NuGet change that library would only run on net462 or later, where the package also carried a facade with the same version. After the NuGet change its a problem because the package only provides the 4.1.0.0 facade for net462
and higher.
@terrajobst, @weshaggard, and I had thought about this and planned for it by having the netstandard2.0 support package supersede those older netstandard constituent packages (see related issue). The idea was the netstandard2.0 support package would be applicable in all cases where it mattered. The problem was I later did an optimization that only applies the ns2 support libs when netstandard.dll is referenced.
The fix here, will be to instead apply the netstandard support libs whenever netstandard.dll or System.Runtime 4.1.0.0 (or later) is referenced.
Activity
livarcocc commentedon Jul 5, 2017
@ericstj is this a change that you can make?
ericstj commentedon Jul 5, 2017
Yeah, I can get a PR ready. I'll need some help getting it in though.
livarcocc commentedon Jul 5, 2017
I can help with that. Thanks.
NightWatchman commentedon Aug 21, 2017
I believe I'm having this issue after installing Visual Studio v15.3.1 and I am not sure what I need to do to resolve it.
I have a WebSite project that references several NuGet packages which target Netstandard 1.6. After installing the new Visual Studio I first encountered Issue and fixed that by applying the workaround:
Then I started getting the YSOD at runtime:

If I set my build output to detailed I can see the following:
I've cleaned and rebuilt the solution, deleted my bin and obj directories and tried again, and installed the NETStandard.Library v2.0.0 package, and I always get the same YSOD and the same errors in the build log.
Do I need to ensure that all of the NuGet packages referenced by the project target NetStandard 2.0? I figured that installing the NETStandard.Library into the web project would fix it if that was the issue but it didn't.
I've also tried both with and without
<DependsOnNETStandard>true</DependsOnNETStandard>
in my project file and it didn't seem to make any difference.ericstj commentedon Aug 21, 2017
You'll get that error if your web app is missing bindingRedirects. @nguerrera reccomended a good solution here: https://developercommunity.visualstudio.com/solutions/98340/view.html
NightWatchman commentedon Aug 21, 2017
@ericstj That's great, thanks! Finding the warning in the Error List pane and double-clicking on it did the trick for me, and all the binding redirects were added to my Web.Config file.