App.Config

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
 
B

Ben Voigt [C++ MVP]

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top