jeudi 8 août 2019

DLL dependency of another DLL not found though loaded

In a C# application I'm Loading 2 DLLs provided by user during runtime(not a pre-difined reference) Let it be A.dll, B.dll. A.dll is referencing B.dll, but they are supplied separately. When I try to access a method from A.dll, with a parameter of type that is declared in B.dll, I get an "Could not load file or assembly 'B, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.", though both DLLs were loaded. Even calling MethodInfo.GetParameters() will theow the exception.

Tried to Load both DLLs with Assembly.Load(), Assembly.LoadFile(), Assembly.LoadFrom(). I set the reference in project A to B.dll as "Copy Local = false".

Any usage of types and method from A or B which does not involve the connection described above seems to work fine.

I made sure both assembly were loaded with AppDomain.CurrentDomain.GetAssemblies() (they both are).

I have to presume I don't have developer access to A.dll and B.dll projects (provided by users), but for testing purpose I can try to change stull in them as well.





Aucun commentaire:

Enregistrer un commentaire