Re: Application cant find dll even when it's in the same directory





My experience was when deploying an exe that called a dll that called a second dll, the second .dll could not be found, even in the same directory.

I tried putting them in the GAC but the 2nd dll would still not be found.

My solution:

Put the dlls in the /winnt/system32 directory.

Then, bingo, it got found.

Think you're out of dll-hell?

Think again, dotnetters!


JohnnySparkles wrote:
Hi All,

I'm working on an application which uses a dll for some of its classes.

I build the application and the dll and it runs fine on any machine with Visual Studio .NET installed on it. Once you take the application and the dll and place them on a machine without Visual Studio .NET the application throws the following error:

Unhandled Exception: System.IO.FileNotFoundException: File or assembly name Clie
ntAPI, or one of its dependencies, was not found.
File name: "ClientAPI"
at main()


=== Pre-bind state information ===
LOG: DisplayName = ClientAPI, Version=1.0.1992.20855, Culture=neutral, PublicKey
Token=null
(Fully-specified)
LOG: Appbase = C:\Documents and Settings\jwieland\Desktop\Signal Testing\
LOG: Initial PrivatePath = NULL
Calling assembly : TestBed, Version=1.0.1992.20856, Culture=neutral, PublicKeyTo
ken=null.
===


LOG: Policy not being applied to reference at this time (private, custom, partia
l, or location-based assembly bind).
LOG: Post-policy reference: ClientAPI, Version=1.0.1992.20855, Culture=neutral,
PublicKeyToken=null
LOG: Attempting download of new URL file:///C:/Documents and Settings/jwieland/D
esktop/Signal Testing/ClientAPI.DLL.


The application is TestBed.exe and the dll is ClientAPI.dll and both are placed in the same directory. Any ideas anyone?

Cheers
John

.



Relevant Pages

  • Re: Cannot find assembly
    ... I am no expert on DLL loading at all so this post is mostly ... The first DLL is found because you are going through the ... But the second DLL is not ... > dll files and their tlb files are all in the same folder. ...
    (microsoft.public.dotnet.framework.interop)
  • Re: Detours and Internet Explorer
    ... How would one then trace the calls made by the second DLL? ... I'm not getting any recv or WSPrecv traces for IE - probably because it uses ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Detours and Internet Explorer
    ... If one DLL uses a second DLL, and only the first DLL has been ... I'm trying to use Detours's TraceTcp sample to monitor the calls made ... Internet Explorer to the winsock libraries, ...
    (microsoft.public.win32.programmer.kernel)
  • Re: GIT GetInterfaceFromGlobal returns E_UNEXPECTED
    ... Microsoft MVP, MCSD ... Side-by-Side assemblies. ... The first dll utilizes the second. ... When the second DLL ...
    (microsoft.public.vc.atl)
  • Extension dll implicitly linking with another extension dll
    ... I have an extension dll that implicitly links with a second extension ... All seems to work fine, however, in the second dll if I call ...
    (microsoft.public.vc.mfc)