Crazy ConfigurationManager

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tom

    Crazy ConfigurationManager

    This seems odd ...

    While debugging my application in VS2008, I can successfully retrieve values
    from my configuration file doing the following:

    string bla = ConfigurationMa nager.AppSettin gs["myValue"];

    I can also successfully save to the config file doing the following:

    Configuration c =
    ConfigurationMa nager.OpenExeCo nfiguration(Con figurationUserL evel.None);
    c.AppSettings.S ettings.Remove( "myValue");
    c.AppSettings.S ettings.Add("my Value", "ItsActualValue ");
    c.Save(Configur ationSaveMode.M odified);
    ConfigurationMa nager.RefreshSe ction("appSetti ngs");

    If I go into my debug directory on my file system and check my exe config
    file, I can actually see that these settings have successfully been written
    to the config file.

    Here's the weird part:
    When I'm finished debugging my app, I stop it by hitting (shift + F5). When
    I do that, my exe config file somehow reverts back to the original state in
    which these settings did not exist in the config file.

    WTH?!?



Working...