c# - Is there any way to configure the initial AppDomain?

问题描述:

I want to make it so my primary AppDomain has ShadowCopyAssemblies set to true.

Is there something I can do (for example perhaps a manifest setting I am missing) that will let the first AppDomain loaded in my executable have have that property set to true or is my only option to create a 2nd AppDomain and have my program do the bulk of it's work in that 2nd domain?

The target environment is a self hosted service, but knowing how to do it for Console or windows applications would be good to know too.

网友答案:

After posting the question I discovered it is a setting you can pass in to the App.config file. What you need to do is set the configuration settings <appDomainManagerType> and <appDomainManagerAssembly> and point it at a 2nd assembly that contains a AppDomainManager.