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.

Multiple library redirect warnings with .NET 4.7.1 and new SDK project format

See original GitHub issue

From @Tornhoof on October 19, 2017 7:56

Upgrading to .NET 4.7.1 with the new SDK format results in multiple library redirect warnings for system libraries (e.g. System.IO). Targeting .NET 4.7 does not have this problem.

There was a conflict between "System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
     "System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not.
     References which depend on "System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime\4.3.0\ref\net462\System.Runtime.dll].
         C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime\4.3.0\ref\net462\System.Runtime.dll
           Project file item includes which caused reference "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime\4.3.0\ref\net462\System.Runtime.dll".
             C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime\4.3.0\ref\net462\System.Runtime.dll
     References which depend on "System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\Facades\System.Runtime.dll].
         C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.codeanalysis.common\2.3.1\lib\netstandard1.3\Microsoft.CodeAnalysis.dll
           Project file item includes which caused reference "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.codeanalysis.common\2.3.1\lib\netstandard1.3\Microsoft.CodeAnalysis.dll".
             C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.mvc.razor\2.0.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Razor.dll
             C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.codeanalysis.common\2.3.1\lib\netstandard1.3\Microsoft.CodeAnalysis.dll
             C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.codeanalysis.csharp\2.3.1\lib\netstandard1.3\Microsoft.CodeAnalysis.CSharp.dll
             C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.mvc.razorpages\2.0.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.RazorPages.dll
             C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.mvc.razor.extensions\2.0.0\lib\net46\Microsoft.AspNetCore.Mvc.Razor.Extensions.dll
             C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.mvc\2.0.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.dll
             C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.mvc.taghelpers\2.0.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.TagHelpers.dll
             C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.mvc.localization\2.0.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Localization.dll
             C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.codeanalysis.razor\2.0.0\lib\net46\Microsoft.CodeAnalysis.Razor.dll
         C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.codeanalysis.csharp\2.3.1\lib\netstandard1.3\Microsoft.CodeAnalysis.CSharp.dll
           Project file item includes which caused reference "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.codeanalysis.csharp\2.3.1\lib\netstandard1.3\Microsoft.CodeAnalysis.CSharp.dll".
             C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.mvc.razor\2.0.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Razor.dll
             C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.codeanalysis.csharp\2.3.1\lib\netstandard1.3\Microsoft.CodeAnalysis.CSharp.dll
             C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.mvc.razorpages\2.0.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.RazorPages.dll
             C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.mvc.razor.extensions\2.0.0\lib\net46\Microsoft.AspNetCore.Mvc.Razor.Extensions.dll
             C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.mvc\2.0.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.dll
             C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.mvc.taghelpers\2.0.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.TagHelpers.dll
             C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.mvc.localization\2.0.0\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Localization.dll
             C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.codeanalysis.razor\2.0.0\lib\net46\Microsoft.CodeAnalysis.Razor.dll

There are warnings for the following libraries

System.ValueTuple,
System.Runtime,
System.IO,
System.Reflection,
System.Security.Cryptography,
System.Linq,
System.Runtime.Extensions,
System.Runtime.InteropServices,
System.IO.FileSystem,
System.IO.FileSystem.Primitives,
System.Xml.ReaderWriter,
System.Security.Cryptography.Primitives,
System.Linq.Expressions,

Steps to reproduce

  1. Create a new solution
  2. Create a web project targeting ASP.NET targeting net471
  3. Create a lib project with XUnit 2.3 and targeting net471 with new SDK project format
  4. Enable the auto binding redirect settings (apparently makes no difference)
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
  1. Add a few unit tests

Expected result

  1. No build warnings

Actual result

  1. Redirect warnings

RedirectWarnings.zip

Copied from original issue: dotnet/project-system#2905

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
copernicus365commented, Mar 9, 2018

<Rant warning /> I can’t even believe this is still going on. It’s been YEARS of such monkey business, and count this as the umpteenth time I’ve torched a whole solution trying to update big full .NET solutions to get in some harmony with the new .NET world. (Which by the way, it really does become all or nothing; to go to net 4.7.1, means projects above those must be 4.7.1 or higher, but if you have underlying projects at a lesser level, you get even more dependency nuget dll nightmares, and finally just update the whole stack of dependencies, which fixes many of the problems, until you find there are still outstanding ones). Many of us would love nothing more than to simply convert to net core, but where that’s impossible. But at least what we can do then is everything possible to update to the latest full framework version to finally get in some harmony with the new netstandard and newer ways of doing things, if not even to share in the new csproj type, and get as many dependency libraries that can convert to net core / standard to do that (you can’t do that if referencing them makes things go bonkers!). I just went thru this in November of 2017, and again had to give up and restore solution and many dependency projects back from backup, because of so many million problems (I could reference the github threads on this but don’t care to find it), that .NET 4.7.1 was supposed to fix. But here we go again. And if you need proof that this has been going on for YEARS, see this article I posted just over 3 years ago, that’s right, THREE years ago: https://stackoverflow.com/questions/28097981/can-the-new-asp-net-5-asp-net-mvc-6-project-type-target-regular-net And yet that promise is still encumbered by this madness. I have all of the problems above popping up, and no solutions were given, and yet it’s March of 2018 now. It’s simply maddening.

0reactions
jwisenercommented, Mar 26, 2018

agreed, a failure, to say the least.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiple library redirect warnings with .NET 4.7.1 and new ...
Upgrading to .NET 4.7.1 with the new SDK format results in multiple library redirect warnings for system libraries (e.g. System.IO).
Read more >
Adding .NET Standard libraries to 4.7.1 lib adds loads of ...
The answer I'm creating for my own question is: Does your .NET Framework project use packages.config ? If it does, DO NOT reference...
Read more >
Redirecting Assembly Versions - .NET Framework
Redirect compile-time binding references to different versions of .NET assemblies, third-party assemblies, or your own app's assemblies.
Read more >
Using .NET Standard with Full Framework .NET - Rick Strahl
If you are a library author, multi-targeting in the newer .NET SDK Style project format is fairly easy to set up and assuming...
Read more >
Microsoft .NET Notebook - Software Development Zone
This information answers the frequently-asked question about how to distribute a common or centralised EditorConfig file, with Code Style and Analysis Rules, 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