Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load file or assembly '***.dll' or one of its dependencies

I have this dll that I created a long time ago and use to connect to the db of a specific software that I develop for. I have had no issues for well over 4 years and countless applications with this dll.

Trying to deploy my latest creation, I get the following error:

System.IO.FileNotFoundException: Could not load file or assembly '***.dll' or one of its dependencies. The specified module could not be found. 

So, for every dll I ever wrote, I always made a simple forms application to test that dll just by itself. Running that simple app yielded the same error. The dll doesn't load or use anything else than: System, System.Data, System.XML. So as far as depencies of it go, I don't see anything wrong.

By the way everything works on a dev station. The problem is limited to deployment stations. .Net and the necessary redistributables, since I do everything in C++, are deployed and working.

Running FUSLOGVW.exe showed everything as working fine.

Running depends.exe said: Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.

I already tried rewriting the whole thing. Which yielded the same results.

Clues anyone?

EDITS

Here is the total error message:

See the end of this message for details on invoking \" just-in-time (JIT) debugging instead of this dialog box.\"  ************** Exception Text **************\" System.IO.FileNotFoundException: Could not load file or assembly 'connectionTo.dll' or one of its dependencies. The specified module could not be found.\" File name: 'connectionToJobboss32.dll'\"    at TESTConnection.Form1.button1_Click(Object sender, EventArgs e)\"    at System.Windows.Forms.Control.OnClick(EventArgs e)\"    at System.Windows.Forms.Button.OnClick(EventArgs e)\"    at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)\"    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)\"    at System.Windows.Forms.Control.WndProc(Message& m)\"    at System.Windows.Forms.ButtonBase.WndProc(Message& m)\"    at System.Windows.Forms.Button.WndProc(Message& m)\"    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)\"    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)\"    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)\" \"    ************** Loaded Assemblies **************\" mscorlib\"     Assembly Version: 4.0.0.0\"     Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)\"     CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll\" ----------------------------------------\" TESTConnection\"     Assembly Version: 1.0.3996.18980\"     Win32 Version: \"     CodeBase: file:///C:/Program%20Files%20(x86)/conn/TESTConnection.exe\" ----------------------------------------\" System.Windows.Forms\"     Assembly Version: 4.0.0.0\"     Win32 Version: 4.0.30319.1 built by: RTMRel\"     CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll\" ----------------------------------------\" System.Drawing\"     Assembly Version: 4.0.0.0\"     Win32 Version: 4.0.30319.1 built by: RTMRel\"     CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll\" ----------------------------------------\" System\"     Assembly Version: 4.0.0.0\"     Win32 Version: 4.0.30319.1 built by: RTMRel\"     CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll\" ----------------------------------------\" 

There is no errors in the event viewer.

like image 826
Dewm Solo Avatar asked Dec 10 '10 16:12

Dewm Solo


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 could not be found?

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.

Could not load file or assembly Winscpnet DLL or one of its dependencies?

You may get this error, if the WinSCP . NET assembly package was downloaded using Microsoft Internet Explorer or Edge browsers and extracted using Windows File Explorer. These applications, under certain circumstances, block libraries downloaded from Internet as potentially harmful, what prevents their loading.

Could not load file or assembly culture neutral Publickeytoken null or one of its dependencies?

This error usually means that the assembly was not found. Try verifying that the file exists in the directory where your application is running.


1 Answers

or one of its dependencies

That's the usual problem, you cannot see a missing unmanaged DLL with Fuslogvw.exe. Best thing to do is to run SysInternals' ProcMon utility. You'll see it searching for the DLL and not find it. Profile mode in Dependency Walker can show it too.

like image 115
Hans Passant Avatar answered Oct 12 '22 08:10

Hans Passant