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
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>
To fix that same error within my solution, not only did I remove the bindingRedirect
for System.Net.Http
from Web.config (see @Rado's answer) but also needed to remove Version
, Culture
, etc. and HintPath
from it's reference in the project file (*.csproj).
Essentially, changed in *.csproj from
<Reference Include="System.Net.Http, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Http.4.1.0\lib\net46\System.Net.Http.dll</HintPath>
</Reference>
to
<Reference Include="System.Net.Http"/>
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