Home All Groups Group Topic Archive Search About

How to use the AppDomainSetup.SetConfigurationBytes

Author
9 Aug 2006 3:51 PM
Antonio
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.

Author
11 Aug 2006 12:19 AM
Orlando
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.
>

AddThis Social Bookmark Button