Anthony Desa
Anthony Desa

Reputation: 1

How can I specify that my DLL should resolve a DLL dependency from the same directory that the DLL is in?

I have my project dependencies setup as following

    Main.exe
       -->B.dll
          -->Common.dll
       -->C.dll
          -->Common.dll
    ProbeLoad
          \A.dll
               -->C.dll
                  -->Common.dll
               -->Common.dll   

When Main.exe loads A.dll from ProbeLoad folder then I want A.ddl to load C.dll and Common.dll from the same folder i.e. ProbeLoad.

The issue that I am facing is that A.dll consumes C.dll and Common.dll which resides in same folder as Main.exe (Verified through Process Explorer)

How can I force A.dll to resolve its dependencies i.e. C.dll and Common.dll from the same folder where A.dll resides.?

I have tried to embed manifest file into dll using mt.exe tool but A.dll continue to resolve its dependency from the same folder as executable. I am trying to achieve side by side execution (with full isoloation)

Following are the content of my manifest files

     **Main.exe.mainfest**
    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
      <assemblyIdentity version="1.0.0.0" processorArchitecture="x86" name="Main"     type="win32" publicKeyToken="9b0499ab61a23bee"/>
     <dependency>
       <dependentAssembly>
         <assemblyIdentity type="win32" name="ProbeLoad\A" version="1.0.0.0"  processorArchitecture="x86" publicKeyToken="9b0499ab61a23bee"/>
       </dependentAssembly>
     </dependency>
    </assembly>
    **A.dll.manifest**
    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
     <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
     <assemblyIdentity version="1.0.0.0" processorArchitecture="x86" name="ProbeLoad\A"  type="win32" publicKeyToken="9b0499ab61a23bee"/>
      <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="ProbeLoad\C" version="1.0.0.0" processorArchitecture="x86" publicKeyToken="9b0499ab61a23bee"/>
        </dependentAssembly>
      </dependency>
   </assembly>

    **C.dll.manifest**
    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
      <assemblyIdentity version="1.0.0.0" processorArchitecture="x86"       name="ProbeLoad\C"  type="win32" publicKeyToken="9b0499ab61a23bee"/>
    </assembly>

Upvotes: 0

Views: 23

Answers (0)

Related Questions