I have several projects in my VS solution. Whenever I add \"System.Net.Http\" NuGet package to one it shows as version 4.2.0.0. Then I do the same and add same NuGet Package
I've had this problem twice now whilst working with Azure Worker roles. Any called to system.net.http simple causes the code to hang, but there is no feedback at all from Azure so it takes hours or days of commenting out code to find the cause let alone a solution.
A simple trick fixed it for me. This isn't my solution, I came across it about 6 months ago, but when the problem happened to me again today, I thought it worth posting.
There is a new solution to this that works as of the 9th of October 2018.
System.Net.Http
to the latest version 4.3.4. If your project has the new project structure, edit it and make sure it includes the following package reference:
<PackageReference Include="System.Net.Http" Version="4.3.4" />
Search your solution and delete any existing binding redirects for System.Net.Http they will look as follows
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
Rebuild, the warning should now be gone and your code should build and run fine
I am working with .NET 4.6.2 and found the same problem. I have two projects a web site and a test project. I review the following:
Both project has installed the NuGet package for System.Net.Http
The references in both program are equal and both point to the same
package
The Problem. The Web.Config and the App.Config from the project point to different System.NET.Http.
I substitute the code in both config to get:
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.3" newVersion="4.1.1.3" />
</dependentAssembly>
in both of them. Then the conflict disappear.