|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to use the AppDomainSetup.SetConfigurationBytespublic const string Config = "<configurationx>" + " <appSettings>" + " <add key=\"Pi\" value=\"3.15\" />" + " </appSettings>" + "</configurationx>"; AppDomainSetup setup = new AppDomainSetup(); setup.SetConfigurationBytes(ASCIIEncoding.UTF8.GetBytes(Config)); then I create a new appdomain with the AppDomainSetup above. AppDomain appDomain = AppDomain.CreateDomain( "New AppDomain", AppDomain.CurrentDomain.Evidence, setup); The problem is that the Config string is ignored. Someone know how to set the App.Config configuration from a string? Thanks. Antonio.
Show quote
"Antonio" wrote:
> I wrote a unit test for load an App.Config file from a string: > public const string Config = > "<configurationx>" + > " <appSettings>" + > " <add key=\"Pi\" value=\"3.15\" />" + > " </appSettings>" + > "</configurationx>"; > > AppDomainSetup setup = new AppDomainSetup(); > setup.SetConfigurationBytes(ASCIIEncoding.UTF8.GetBytes(Config)); > > then I create a new appdomain with the AppDomainSetup above. > > AppDomain appDomain = AppDomain.CreateDomain( > "New AppDomain", > AppDomain.CurrentDomain.Evidence, > setup); > > The problem is that the Config string is ignored. > Someone know how to set the App.Config configuration from a string? > Thanks. > Antonio. > |
|||||||||||||||||||||||