Could not load file or assembly 'System.Net.Http, Version=4.1.1.1 .Net Standard

okeziestanley picture okeziestanley · Aug 8, 2017 · Viewed 8.8k times · Source

I am building a .Net standard library, which builds fine but on testing, I get this error

HResult=-2147024894 Message=Could not load file or assembly 'System.Net.Http, Version=4.1.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Source=Library Trial

I have installed System.Net.Http Nuget Package still no success. It's a fresh project so what must I be doing wrong

Answer

Rado picture Rado · Jan 25, 2018

As Ved Tiwari said above, remove the reference to "4.1.1.1" in your app.config (or solution/project).

For example, I removed the below and it started working again:

<dependentAssembly>
    <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.1.1.2" newVersion="4.1.1.2" />
</dependentAssembly>