Why can't my application find the dependent dll in the same directory?

I have a simple console test program ConsoleApplication1.exethat references another assembly clipper.dll.

On the three machines on which I tested them, you can place both files, for example. c:\test\and execute ConsoleApplication1.exe.

On another machine, which is the client machine, the launch ConsoleApplication1.execauses the program to crash, and the following information is printed on the console:

C:\test>dir
 Volume in drive C has no label.
 Volume Serial Number is 7C46-414F

 Directory of C:\test

07/12/2010  06:08 PM    <DIR>          .
07/12/2010  06:08 PM    <DIR>          ..
07/12/2010  05:13 PM            11,776 ClassLibrary1.dll
07/12/2010  05:13 PM            30,208 ClassLibrary1.pdb
07/12/2010  04:55 PM             3,572 ClassLibrary1.tlb
19/11/2010  02:46 PM           235,008 clipper.dll
19/11/2010  02:46 PM         1,534,976 clipper.pdb
07/12/2010  05:13 PM             6,144 ConsoleApplication1.exe
07/12/2010  05:13 PM            11,776 ConsoleApplication1.pdb
01/08/2010  12:52 PM           139,264 nunit.core.dll
01/08/2010  06:41 AM            57,344 nunit.core.interfaces.dll
01/08/2010  06:41 AM           135,168 nunit.framework.dll
01/08/2010  06:41 AM           547,262 nunit.framework.xml
              11 File(s)      2,712,498 bytes
               2 Dir(s)  477,821,784,064 bytes free

C:\test>ConsoleApplication1.exe

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass
embly 'clipper.dll' or one of its dependencies. The specified module could not b
e found.
   at ConsoleApplication1.Program.Main(String[] args)

This is strange for me, although I do not understand the rules for loading the dll comprehensively, I thought that it would look for CWD for the specified file. And the fact that this same setup works on other computers that I tried is also odd.

Curiously, on a working computer, if I remove clipper.dll, then run it:

C:\Temp>ConsoleApplication1.exe

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass
embly 'clipper, Version=1.0.3975.26584, Culture=neutral, PublicKeyToken=null' or
 one of its dependencies. The system cannot find the file specified.
   at ConsoleApplication1.Program.Main(String[] args)

, .

  • ConsoleApplication1.exe clipper.dll .NET 4.
  • ​​ .NET 4. .NET sdk
  • clipper.dll ++ ++/CLI. , , , ++/CLI.NET, , . , .
  • , , COM- ( foo.dll), clipper.dll - . .
+5
5

CRT runtime DLL ? Release . CRT .

+11

, u, dll system32, 2 1) 2) , , dll

+1

++ (CRT) .

+1

,

, , COM- ( foo.dll), clipper.dll - . .

COM- (foo.dll), ?

pdbs .

0

? - , zip , . " b e found. "

Windows , . Windows "" , . , , "", .

http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=mpe&DownloadId=163767

Alternatively, you can unlock the zip file before extracting it, and then all extracted files will also be unlocked.

0
source

All Articles