views:

148

answers:

1

In .net, one can create an AddIn within a new AppDomain. The creation of new AppDomains is nothing new, and one can use an AppDomainSetup class to specify all the startup parameters (such as where to find the app.config) of the newly created AppDomain. However, when activating an AddInToken using a new AddInProcess (which specifies that the AddIn should be instantiated within an entirely new process), one does not have direct access to the AppDomainSetup parameters that will be used to create the AppDomain within the new Process.

Is there ANY way to do this?? I really need to be able to force my new AddIns to use new app.config settings, and various other customizations on the AppDomain.

Thanks for any help here...

A: 
var addins = AddInStore.FindAddIns(typeof(AddInHostView), addInRoot);
foreach (var addin in addins)
{
    var addinInstance = addin.Activate<AddInHostView>(AddInSecurityLevel.FullTrust);

    // snip
    // do stuff
    // snip
}

With this code (I understand FullTrust is bad, but for my application is is needed) I am able to specify a seperate app.config (named the same as the Addin assembly) in each directory.

\AddIns
 \AddIn1
   AddIn1.dll
   AddIn1.dll.config
AdamSane