By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,463 Members | 2,954 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,463 IT Pros & Developers. It's quick & easy.

Loading dependent assemblies dynamically from different folders

P: n/a
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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.