Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load file or assembly ... The parameter is incorrect

People also ask

Could not load file or assembly VS 2019?

Restart Visual Studio, clean and build a solution. Remove the class library references and add it again. Tools > Import and Export Settings Wizard > Reset all settings (maybe some setting was not well configured).

Can not load file or assembly?

Http 5.2. 0.0? In summary if you get the "Could not load file or assembly error", this means that either your projects or their references were built with a reference to a specific version of an assembly which is missing from your bin directory or GAC.


Looks like a corrupted assembly being referenced.

Clear both:

  1. the \bin folder of your project

  2. the temp folder (should be C:\Users\your_username\AppData\Local\Temp\Temporary ASP.NET Files in windows 7)

and see if the error still happens


Depending on if your are running X64 you might need to clean up a couple more spots. Just cleaning up my user directory was not enough.

  1. %TEMP%\Temporary ASP.NET Files
  2. C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
  3. C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
  4. C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files
  5. C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files

This list will grow as if you have other versions of the framework installed.


I had to clear

C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files

Only then did the issue get resolved.


To know what to clear for sure - add the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion\EnableLog (DWord set to 1).

Then you will see output like below. This tells you where asp.net is attempting to load your DLLs. Clear this directory.

LOG: This bind starts in default load context.
LOG: Using application configuration file: c:\app\AtlasAdvisor\web\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL **file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/3c8629f7/dfa387b6/Avanade.ViddlerNet.DLL.**
LOG: Attempting download of new URL **file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/3c8629f7/dfa387b6/Avanade.ViddlerNet/Avanade.ViddlerNet.DLL**.

Clear out the temporary framework files for your project in:-

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\


You can also clear the packages directory and allow NuGet to re-download missing packages

it solved the issue for me


Delete all files from these folders .

C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files