1

I've created a brand new ASP.NET Framework MVC project (using the built in project template in Visual Studio 2019). This project was converted to use PackageReference using the answer provided here.

When I do a "Rebuild Solution", everything is fine.

I then add a new ASP.NET Framework Class Library (using the build in project templte in Visual Studio 2019) to the solution.

I do another "Rebuild Solution" and everything is still fine.

Now, when I add a reference to the class library project in the web project I get the following warnings when rebuilding the solution:

Consider app.config remapping of assembly "System.Buffers, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" from Version "4.0.2.0" [] to Version "4.0.3.0" [C:\Users\Me\.nuget\packages\system.buffers\4.5.0\ref\net45\System.Buffers.dll] to solve conflict and get rid of warning.
3>  Consider app.config remapping of assembly "System.Memory, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" from Version "4.0.1.0" [] to Version "4.0.1.1" [C:\Users\Me\.nuget\packages\system.memory\4.5.3\lib\netstandard2.0\System.Memory.dll] to solve conflict and get rid of warning.
3>  Consider app.config remapping of assembly "System.Numerics.Vectors, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.1.3.0" [] to Version "4.1.4.0" [C:\Users\Me\.nuget\packages\system.numerics.vectors\4.5.0\ref\net46\System.Numerics.Vectors.dll] to solve conflict and get rid of warning.
3>  Consider app.config remapping of assembly "System.Runtime.CompilerServices.Unsafe, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.0.4.1" [] to Version "4.0.5.0" [C:\Users\Me\.nuget\packages\system.runtime.compilerservices.unsafe\4.6.0\ref\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll] to solve conflict and get rid of warning.
3>  Consider app.config remapping of assembly "System.ValueTuple, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" from Version "4.0.2.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\Facades\System.ValueTuple.dll] to Version "4.0.3.0" [C:\Users\Me\.nuget\packages\system.valuetuple\4.5.0\ref\net47\System.ValueTuple.dll] to solve conflict and get rid of warning.

Here's a selection from the detailed build output:

1>  Encountered conflict between 'Reference:C:\Users\Me\.nuget\packages\system.valuetuple\4.5.0\ref\net47\System.ValueTuple.dll' and 'Platform:System.ValueTuple.dll'. Choosing 'Reference:C:\Users\Me\.nuget\packages\system.valuetuple\4.5.0\ref\net47\System.ValueTuple.dll' because AssemblyVersion '4.0.3.0' is greater than '4.0.2.0'.
1>  Encountered conflict between 'Platform:System.ValueTuple.dll' and 'CopyLocal:C:\Users\Me\.nuget\packages\system.valuetuple\4.5.0\lib\net47\System.ValueTuple.dll'. Choosing 'CopyLocal:C:\Users\Me\.nuget\packages\system.valuetuple\4.5.0\lib\net47\System.ValueTuple.dll' because AssemblyVersion '4.0.3.0' is greater than '4.0.2.0'.

1>  Unified primary reference "System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51".
1>      Using this version instead of original version "4.0.2.0" in "C:\Users\Me\.nuget\packages\system.text.json\4.6.0\lib\net461\System.Text.Json.dll" because AutoUnify is 'true'.
1>      Resolved file path is "C:\Users\Me\.nuget\packages\system.valuetuple\4.5.0\ref\net47\System.ValueTuple.dll".
1>      Reference found at search path location "{RawFileName}".
1>      This reference is not "CopyLocal" because at least one source item had "Private" set to "false" and no source items had "Private" set to "true".
1>      The ImageRuntimeVersion for this reference is "v4.0.30319".

I haven't done anything other than creating a project, converting to PackageReference, adding a class library, and adding a reference to that library. I haven't made any other changes at all. I haven't even added any new NuGet packages, so everything should be as clean as it can be. Yet I get these warnings!

If I create an identical solution without converting to PackageReference the warnings are never displayed, so it obviously has something to do with PackageReference, but what/why/how?

So why do these warnings appear in a "clean" solution? Is there anything I can do to make them disappear without having to add remappings in the web.config file?

Download a demo solution with the issue

TheHvidsten
  • 4,028
  • 3
  • 29
  • 62
  • It is quite strange. And when I created a net framework 4.7.2 asp net mvc project A and then change it to `PackageReferene`. After that, create a new empty net framework class library project B, reference it into A, I did not face any warnings as you described. Also, did you install any packages like `System.ValueTuple`? It does not exist under the default project and my projects do not contain it. It is quite strange. – Mr Qian Mar 17 '21 at 08:17
  • Maybe try these:1) delete all files under `C:\Users\xxx\.nuget\packages` 2) delete `bin` and `obj` folders all the two projects 3) check `auto-generate binding redirects` under right-click Project-->Properties-->Application. If it does not work, please share the two `csproj` files with us and we could troubleshoot it more quickly. – Mr Qian Mar 17 '21 at 08:18
  • @PerryQian-MSFT `System.ValueTuple` has not been installed by me. I've only created an MVC project (.NET Framework 4.8), converted to packageref, added a class library, added reference to that library into the MVC project. I also tried deleting what you suggested, but it didn't help. I've updated the question with a link to a complete demo project that has this issue. – TheHvidsten Mar 17 '21 at 10:03
  • I also faced the same behavior and actually non-sdk net framework projects still have the assembly conflicts problem although it changed to use PackageReference. Non-sdk net framework projects essentially have this problem no matter it changed to use PackageReference. And The Team still have some work to handle non-sdk net framework projects with the new PackageRefenece since PackageReference is added into non-sdk projects since `VS2017`. It still has some work to handle with non-sdk net framework projects. – Mr Qian Mar 19 '21 at 10:04
  • As a suggestion, you should double-click on the warning and add the binding redirect into web.config. – Mr Qian Mar 19 '21 at 10:05
  • Does this answer your question? [Consider app.config remapping of assembly with no app.config mapping](https://stackoverflow.com/questions/45444112/consider-app-config-remapping-of-assembly-with-no-app-config-mapping) – Michael Freidgeim Feb 09 '22 at 21:07

0 Answers0