5

I have looked this problem and i found many entries on the net about it.. but none that i could understand. maybe you can help? I have a dll file (created from a c script) and i created a GUI using visual C# 2010 for my program. I have tested my application on 5 different computers. On my computer and the computer where i created the application, the user interface and the program runs without any trouble. However when i pass it to other computers i receive the following error line AFTER execution of the program (which means that the user interface opens, but when i insert all my values and run the code stored in the dll file i receive the errir) "Could not load file or assembly "ParsingDll.dll" or one of its dependencies. the specified module could not be found."

All the computers run microsoft windows 7 and are 64bit. The dll file "ParsingDll.dll" is the one containing my code executed by the GUI, and it is in the same folder as the executable.

Ill appreciate it if someone could help me out with this and take it step by step with me as im new to these kind of stuff.

Many thanks to you all.

badmanjoe
  • 91
  • 2
  • 4
  • don't forget to include the dlls you used to create your C dll with the project. – Benjamin Danger Johnson Oct 11 '12 at 23:07
  • The whole of the error message is important: "Could not load file or assembly "ParsingDll.dll" **or one of its dependencies**." (emphasis added). Sounds like it can find ParsingDll.dll just fine, but not something required by it. – Bevan Oct 11 '12 at 23:21
  • If you have no idea what dependencies your native DLL has then SysInternals' ProcMon utility can tell you. You'll see your process looking for the DLL and not find it. High odds that it is a file named msvcrxxx.dll where xxx is a number. You can avoid that dependency with the /MT compile option in your C project. – Hans Passant Oct 11 '12 at 23:58
  • @Benjamin i tried to add all dll files used in the folder.. still didnt work. w – badmanjoe Oct 12 '12 at 07:39
  • These are the loaded assemblies (what shoes on the error note) I dont see the "ParsingDll.dll" there – badmanjoe Oct 12 '12 at 07:44

3 Answers3

6

One of the used assemblies might require a (native) library that isn't available.

You can enable fusion logging to find out exactly what is causing the trouble:

This logs what gets loaded, and where the fusion loader looks for assemblies, turn on fusion logging in the registry:

Add the following values to

 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion

Add:

 DWORD ForceLog set value to 1
 DWORD LogFailures set value to 1
 DWORD LogResourceBinds set value to 1
 String LogPath set value to folder for logs e.g. C:\FusionLog\

This folder must exist, and end with the backslash

(instructions copied from How to enable assembly bind failure logging (Fusion) in .NET)

Community
  • 1
  • 1
sehe
  • 374,641
  • 47
  • 450
  • 633
  • Fusion doesn't track dependencies for native DLLs. – Hans Passant Oct 11 '12 at 23:56
  • @HansPassant based on your name I'm willing to doubt myself. But I'm _pretty_ sure I have seen it on more than one occasion. I get a log directory structure nicely split in 'Native'/'Managed' IIRC – sehe Oct 12 '12 at 00:01
  • 1
    You saw "native images" getting loaded. Produced by ngen.exe by pre-jitting assemblies, name ends with ".ni.dll" – Hans Passant Oct 12 '12 at 00:07
  • @HansPassant ah. That explains. Would still be able to go from Mixed Mode assemblies to indirect (native) dependencies using DependencyWalker, right? Still, not integrated. Good point – sehe Oct 12 '12 at 00:10
0

Import the dll, and compile all the projects including the dll. Refresh, restart, reboot the computer if necessary. Make sure the DLL exists on the computer. Reboot, refresh, recompile, clean should fix it.

iefpw
  • 6,816
  • 15
  • 55
  • 79
  • What help is this going to give? If the program executes on one machine (already compiled) - recompiling will not fix the issue. This sounds like the standard IT Support person telling a user to reboot their machine 3 times and see if it works.....As other users have stated - the machines that are not working have an environment issue (missing dll's, AV blocking ,etc). – tsells Oct 12 '12 at 04:20
0

Check to see if your ParsingDll.dll is blocked. You can check by looking at the dll file's properties. If it is blocked, there will be an "Unblock" button.

Spevy
  • 1,325
  • 9
  • 22