question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Referencing NETStandard1.5 / NETStandard1.6 library in NET461 project gets wrong facades

See original GitHub issue

See https://github.com/dotnet/core/issues/730#issuecomment-313152425.

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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ericstjcommented, 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

1reaction
NightWatchmancommented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NET Framework 4.6.1 application has errors referencing . ...
5 or later library was referenced. As a result installing a netstandard1.0-1.4 library in a net461-47 project and referencing NETStandard.
Read more >
Nuget Error While Referencing .NET Standard Library ...
I have finally installed Visual Studio 2017.2 and am trying to get my first project working, but am running into some trouble that...
Read more >
Multi-targetting .Net Framework and .Net Core in a single project
A 15-second guide and 15-minute walk through. You have a .Net Core project, whether a netstandard library, or a netcore app, and you'd...
Read more >
Building .NET Framework ASP.NET Core apps on Linux ...
In this post I describe the steps to get an ASP. ... file to your project and reference it in each project that...
Read more >
Target frameworks in SDK-style projects - .NET
When you target a framework in an app or library, you're specifying the set of APIs that you'd like to make available to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found