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

could not load file or assembly dll
could not load file or assembly in c:windows application
could not load file or assembly or one of its dependencies an attempt was made
could not load file or assembly visual studio 2017
could not load file or assembly powershell
could not load file or assembly version=1.0.0.0 culture=neutral publickeytoken=null
could not load file or assembly visual studio 2019
could not load file or assembly excel

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>

How to resolve “Could not load file or assembly … or one of its , When we use multiple versions of same assembly, it is more likely to encounter this runtime exception. It is easy to resolve provided that the new assembly  How to resolve “Could not load file or assembly … or one of its dependencies” and why this exception thrown in .Net?

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"/>

Could not load file or assembly or one of its dependencies, Check if you are referencing an assembly which in turn referencing an old version of unity. For example let's say you have an assembly called  “Execute CREATE PARTITIONS: Error: Could not load file or assembly 'Microsoft.AnalysisServices.AdomdClientUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified."

If you installed the System.Diagnostics.DiagnosticSource dependency, remove it and update System.Net.Http to version 4.1.1.1

Error : Could not load file or assembly or one of it's dependencies , Yeah!!! I found a solution for this terrible error First of all Thanks for every one who tried to help me Here's my solution Right Click on the  Could not load file or assembly 'XXXX, Version=X.Y.Z.W, Culture=neutral, PublicKeyToken=eb42632606e9261f' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.

Add following in your web.config file:

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

Fixing the "Could not load file or assembly or one of its , This post describes how to fix the “Could not load file or assembly '[​assemblyname]' or one of its dependencies. An attempt was made to load a  I'm having another of these "Could not load file or assembly or one of its dependencies" problems. Additional information: Could not load file or assembly 'Microsoft.Practices.Unity, Versi

Could not load file or assembly 'xxx' or one of its dependencies error , The system could not find the 'Episerver.Forms.Core' assembly file to load. There are some workarounds for this issue: The dll file may not be in  Check the list of Dll's in the output folder. Make sure all needed dll's are present. Try to check the properties of 3rd party or non .NET framework assembly to have the "Copy Local" set to "True".

[Solved] Could not load file or assembly (dll file), So it works if I change in the c# project from Any CPU to x86(all dlls are compiled in WIN32) from Properties -> Build -> Platform Target. Could not load file or assembly 'Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

'Could not load file or assembly' error, What could be the problem and how can we fix it? Thanks. Regards. Server Error in '/esprit' Application. Could not load file or assembly 'Microsoft  Could not load file or assembly "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" or one of its dependencies. The system cannot find the file specified. The project's packages include:

Comments
  • Please provide a minimal reproducible example. We don't know what your project looks like, what the project type is, or how you're testing it. Versioning can be very tricky - the details all matter.
  • Some where in your project is trying to reference the version 4.1.1.1 which is different from the one which is loaded through Nuget. Try searching in packages.config file. and change the version name to the one which you are referencing through Nuget.
  • Thanks, I just gave up and used the new .Net standard 2.0 on VS 2017. And it just works. Thanks Jon, I was using Net standard 1.6 on VS 2015, didn't do anything special, just create a fresh project and reference system.net.http namespace. Thanks
  • Possible duplicate of Could not load file or assembly System.Net.Http version 4.1.1.0
  • @JonSkeet: The MCVE is trivial to make. Using VS2017 (15.3.3), create a new C# .NET Standard library, with the .NET Framework version at the top set to 4.6.1 (will default to .NETStandard v1.4). Add a static function to it that calls new System.Net.Http.HttpClient();. Create a second C# project in the same solution, this one a desktop console app. Reference the .NETStandard library. In the console app's Main function, call the library's static function. Run as Debug, changing nothing. Behold an exception. It took me longer to write this than it did to repro the issue.
  • No, I don't have that dependency
  • Remove reference to assembly and then add new reference via Nuget! The actual System.Net.Http version doesn't matter. After removing reference to assembly.
  • You may be refer this site link