المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Load Type in DLL in a different AppDomain



C# Programming
07-17-2009, 12:21 PM
Hi,

First of all, excuse my English.
My app (Compact Framework) loads 2 copies if the same dll (exactly the same DLL renamed) using reflection.
The DLL should load the corresponding config file according to the DLL name (if the DLL is ModuleA.dll the config is ModuleA.txt, and so on).
My problem is this:
When I load the first DLL, everything goes OK, but when I load the second one when I do Assembly.LoadFrom( FullPath ) it loads the first DLL insteag of the 2nd one, despite the fact that FullPath contains the first DLL's path.
In addition there are the variables which shoul be global to each DLL. As everything is loaded from the first DLL, the globals are the first DLL's ones.

After looking for info I realised that what I need to do is to load each DLL in a different AppDomain, so they are isolated from each other.

To summarize:

One compilation: MyModule.dll
2 copies of the same DLL: MyModuleA.dll & MyModuleB.dll
One config file for each DLL: MyModuleA.txt & MyModuleB.txt
One appdomain for each DLL is needed.

Anyone knows how to do this in Compact Framework?