Home > Software engineering >  System.Net.Http 4.2 with .NET 4.7
System.Net.Http 4.2 with .NET 4.7

Time:03-19

How to get rid of warnings from Build output?

All projects in solution are targeting .NET Framework 4.7. It's a huge solution with 50 projects which I am new to. Not sure what change caused these warnings, probably adding System.Web.Http.SelfHost.dll assembly. Build output spills this no matter the assembly redirects binding. Also, I'm using Visual Studio 2019 (looks like the source dll for reference System.Net.Http v4.2).

(ResolveAssemblyReferences target) -> 
Found conflicts between different versions of "System.Net.Http" that could not be resolved.
There was a conflict between "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
     "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not.
  References which depend on "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.Net.Http.dll].
    C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.Net.Http.dll
  References which depend on "System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:\dev\Build\System.Net.Http.dll].
    C:\dev\Build\CommonLib.dll
    C:\dev\Build\AnotherLib.dll
    C:\dev\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll
    C:\dev\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll
    C:\dev\Build\System.Web.Http.SelfHost.dll
    C:\dev\Build\netstandard.dll

after I tried this, additional references were added in Build output, like:

Org.Lib.Workflow, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL
System.Web.Http.SelfHost, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL

also tried the top voted one (newVersion="4.0.0.0"), but it didn't change anything

CodePudding user response:

Per suggestion and since I needed to use version 4.2, I have copied out the corresponding version to repository and added reference to it.

  • Related