468,251 Members | 1,491 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,251 developers. It's quick & easy.

Loading dependent assemblies dynamically from different folders

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

Mar 6 '06 #1
0 1388

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.