Execute an assembly from another assembly and setting the app base

G

Guest

[C#]

I need to execute another assembly from my code. The assembly I need to
execute uses reflection to dynamically load plug-ins. I create a new Domain
and execute the new assembly within this domain. The application throws an
error as it is looking for the plugins in the base folder for my application,
and not its own. Does anybody know how I set the base folder of the
Application I need to execute?? I've tried setting the
DynamicApplicationBase() but that doesn't seem to work :blush:(

My code is roughly as follows:

AppDomainSetup setup = new AppDomainSetup();
setup.ApplicationName = "AppToLoad";
setup.ApplicationBase = "C:\AppToLoad.exe;
setup.DynamicBase = "C:\AppToLoad.exe";

AppDomain domain = AppDomain.CreateDomain("MyDomain", null, setup);
domain.SetDynamicBase("C:\AppToLoad.exe");
domain.ExecuteAssembly("C:\AppToLoad.exe");

AppDomain.Unload(domain);


Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top