App.Config

  • Thread starter Thread starter CTG
  • Start date Start date
C

CTG

I am trying to add something to my App.connfig xml file.

I try something like the following:


config = ConfigurationManager.OpenExeConfiguration
(ConfigurationUserLevel.None);
config.AppSettings.Settings.Add("This", "That");
config.Save();
ConfigurationManager.RefreshSection("appSettings");


Ok , file is updated but as soon as you leave the application ,
APp.config goes back to what it used to be before teh update ....


Does nyone know why as I m running out of ideas...

Thanks
 
CTG said:
I am trying to add something to my App.connfig xml file.

I try something like the following:


config = ConfigurationManager.OpenExeConfiguration
(ConfigurationUserLevel.None);
config.AppSettings.Settings.Add("This", "That");
config.Save();
ConfigurationManager.RefreshSection("appSettings");


Ok , file is updated but as soon as you leave the application ,
APp.config goes back to what it used to be before teh update ....


Does nyone know why as I m running out of ideas...

Maybe your changes are going to the user-specific config file so the
machine-wide file is not changed? Or your build process is replacing the
file in the run directory with the file in the source directory?
 
Back
Top