DCSIMG
October 2011 - Posts - Tamir Shlomi's Blog

Tamir Shlomi's Blog

Welcome to Tamir Shlomi's blog. All about .NET, OOP and SQL server

October 2011 - Posts

System.IO.FileNotFoundException: Could not load file or assembly ‘Assembly’ or one of its dependencies. The system cannot find the file specified

First step: check if the assembly is really in the bin folder.

It’s there but you still get the error?

There might be few reasons for the framework to fail when trying to load your assembly.
To find the real one you can use nice tool from MS, called “Fuslogvw.exe” which is assembly binding log viewer you can use for your .NET application (it’s auto installed with VS).

After opening this tool, start your application and wait for the exception to be thrown.
go back to the tool, hit the refresh to watch the list of the assemblies your application tried to load, double click the one that cause the exception to view the log details.

In my case I found the following error:
Bind result: hr = 0x8007000b. An attempt was made to load a program with an incorrect format
------
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.

After having the exact error in my hand, I could google and find it was 32/64 bit issue.
The problematic assembly was 32 bit instead of 64.

I think it’s a great diagnostic tool.

HTH,
Tamir.