In my diagnostic view of my build output shows this conflict
There was a conflict between "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Net.Http, Version=4.1.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". (TaskId:20) "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "System.Net.Http, Version=4.1.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not. (TaskId:20) 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.6.1\System.Net.Http.dll]. (TaskId:20)
I got here by adding the RestSharp nuget package. I was not having an issue until I installed this and I think one of the pieces that came with it may have caused this issue. I tried to uninstall it but that did not work.
In summary if you get the "Could not load file or assembly error", this means that either your projects or their references were built with a reference to a specific version of an assembly which is missing from your bin directory or GAC.
Provides a programming interface for modern HTTP applications, including HTTP client components that allow applications to consume web services over HTTP and HTTP components that can be used by both clients and servers for parsing HTTP headers. Commonly Used Types: System.
Installing Nuget Package: System.Net.Http version 4.3.3 installs the correct Version=4.1.1.2
this will result in the following reference in your project file:
<Reference Include="System.Net.Http, Version=4.1.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>..\..\..\..\packages\System.Net.Http.4.3.3\lib\net46\System.Net.Http.dll</HintPath> </Reference>
If you using vs2017, some project will force u reference to system.net.http (4.2.0.0) When you install from nuget (version 4.3.3) and your system.net.http will be 4.1.1.2
-> it will be conflict
So in your web.config or app.config, you can change to 4.1.1.2 or 4.2.0.0 depend on which version was copy to bin folder when runtime
<dependentAssembly> <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.1.1.2" /> </dependentAssembly>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With