Hi all,
I have a problem in loading Assembly dynamically through the Reflection.
I want to Load an assembly, say, Main.dll. The Main.dll is dependent on a
DLL, say Abc.dll, which is placed in another known directory.
\AppRoot\Main.dll
\AppRoot\AGroupOfDLLs\Abc.dll
I am using “Assembly.LoadFrom(pathToMaindll)” to load the DLL, but as the
Main.dll needs Abc.dll which located somewhere else, obviously I need to
provide path for Abc.dll.
I appended the path of Abc.dll in current domain by,
“oAppDomain.AppendPrivatePath (pathToAbcDll)”, which, I hope, is the right
thing to do.
Now when I load Main.dll using “Assembly.LoadFrom(pathToMaindll)”, it throws
System.Reflection.ReflectionTypeLoadException, saying "One or more of the
types in the assembly unable to load".
It is necessary for me to keep the DLLs in different folder. I also
brainstormed for other possible route, but it seems I need to go this way
only.
In nutshell, the problem is to load an assembly, which is dependent on some
assemblies placed in another folder.
It would be great for me to have the solution. If anyone can point some link
where advance (working related) topics of .NET are explanation then that
would also be of ample use to me.
Thanks