Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Could not load the assembly file

I got the following error when running my first HelloWorld Windows phone 7 application.

Could not load the assembly file://\linkdotnet.local\linkdev\salma.mohamed\my documents\visual studio 2010\Projects\Assign1\Assign1\obj\Debug\Assign1.dll. This assembly may have been downloaded from the Web. If an assembly has been downloaded from the Web, it is flagged by Windows as being a Web file, even if it resides on the local computer. This may prevent it from being used in your project. You can change this designation by changing the file properties. Only unblock assemblies that you trust. See http://go.microsoft.com/fwlink/?LinkId=179545 for more information.

Any Idea how to resolve it. Thanks alot in advance.

like image 845
Salma Hamed Avatar asked Jul 19 '11 12:07

Salma Hamed


People also ask

How do you fix Could not load file or assembly or one of its dependencies?

There are some workarounds for this issue: The dll file may not be in /bin folder. Just copy the dll file to /bin folder or set this preference Copy Local = True from Visual Studio. If the problem persists, check if the version of the assembly that is referenced is different than the version it is looking for.

Could not load file or assembly from GAC?

The solution is to compile the Interop yourself: 1 - Unregister your dll and the Interop from the GAC. The /machine:Agnostic causes the Interop to be built targeting the MSIL Processor Architecture, which is the same as my dll. 6 - Add a reference in your project to the new Interop.

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).

Could not load file or assembly manifest definition does not match the assembly reference?

The located assembly's manifest definition does not match the assembly reference. As stated, this is caused when the version of a . dll file in the /bin directory (assembly reference), is not the same as specified in the web. config (assembly manifest).


1 Answers

I am assuming this assembly was in a zip file you downloaded from the internet? if that is the case you need to 'unblock' it. Right click the assembly within Windows Explorer, the click the 'unblock' button. See the example below:

enter image description here

like image 148
ColinE Avatar answered Oct 06 '22 22:10

ColinE