Executing an Assembly in its own process - BasePath

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have an application (AppA) that needs to execute another application
(AppB). AppB dynamically loads plugins from a relative file path (ie
C:\AppB\Plugins). When I execute AppB from AppA then it searches for the
plugins in a relative path based on AppA (ie C:\AppA\Plugins), and
consequently won't load.

Code is similar to this...

AppDomainSetup setup = new AppDomainSetup();
setup.ApplicationName = "AppB";
AppDomain domain = AppDomain.CreateDomain("AppBDomain", null, setup);
domain.ExecuteAssembly("C:\AppB\AppB.exe");

Cheers
 
Why not having your main application entry as APPA.EXE and then having the
rest of your application feature as assemblie (APPB.DLL) ?


First it will be more easy to maintain and portable

I am building a similar plug in applciation. I have a main application which
should autoconfigured menus and functions absed on existing plugins which
loaads dynamically, it works great.

YOur plugin object will be then created by using :

objDomain =
AppDomain.CurrentDomain.CreateInstanceFromAndUnwrap(Application.StartupPath &
PLUGINS_FILE_PATH & "\myplugin.dll", "myNamespace.APPB.myClassName)

you can then retriev object property by writnig
return (CType(objDomain, IPlugIn).Icon)

hope it helps
serge
 
Back
Top