jeudi 17 mars 2016

Assembly.LoadFile look dependencies in Location of Executeable

I wrote a wrapper class which loads other assemblies using reflection. Wrapper.dll is also being loaded by a process through reflection following is the diagram to explain the scenario.

Process.exe  
         |___Loads__ Wrapper.dll  
                         |_______Loads___1.dll  
                                           |___ Depends___ xyz.dll  

Following is the file Structure

Root
  |___A  
  |   |__Process.exe  
  |___B  
      |__Wrapper.dll   
      |__C
         |__1.dll
         |__xyz.dll

I am using Assembly.LoadFrom(@"c:\root\B\C\1.dll"); function to load the 1.dll in Wrapper.dll however it fails to find the dependencies as it tries to find the dependencies in A dir, the same directory where we have process executable.





Aucun commentaire:

Enregistrer un commentaire