Could not load file or assembly Exception from HRESULT: 0x80131040

What worked for me immediately was:

  • I located bin folder (picture below shows).

  • moved all dll in other folder for safety.

  • then rebuild ed the project.

  • after solved the issue, deleted old dll files.

Open file location


I had the same issue the NuGet package version was not the same a the one on the references in the project. I had to change the version on the config to match the one in the references from the project. Go to References --> right-click on dll file that causing the problem --> select the properties --> check the version --> match the version in properties to the web config. This should fix the problem.


Finally found the answer!! Go to References --> right cilck on dll file that causing the problem --> select the properties --> check the version --> match the version in properties to web config

<dependentAssembly>
    <assemblyIdentity name="YourDllFile" publicKeyToken="2780ccd10d57b246"               culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-YourDllFileVersion" newVersion="YourDllFileVersion" />
  </dependentAssembly>

If your solution contains two projects interacting with each other and both using one same reference, And if version of respective reference is different in both projects; Then also such errors occurred. Keep updating all references to latest one.