App.Config changes lost

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cloud255
    Recognized Expert Contributor
    • Jun 2008
    • 427

    App.Config changes lost

    Hi,

    I have an application config file in which i create a key, i dont give this key a value. when the user runs the application, they will select a value which must then be stored to this key.

    I use C# with the following code:

    Code:
    Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
    
    config.AppSettings.Settings["ProfilesWorkingDirectory"].Value = dlgWorkingDir.SelectedPath;
    
    config.Save();
    Now this works fine, the user selects a value and the application remembers this value. But when i close the project and rebuild the solution, the value is gone.

    Is the build procedure over writing the config file?
    Why am i losing that value?

    Thanks in advance
  • TommyGunn
    New Member
    • Aug 2008
    • 7

    #2
    Is the build procedure over writing the config file?

    Yes. Once you build the application, you may be able to exclude it from your project so it is not overwritten again. You can also just use two versions and use the development version to overwrite the deployed version (minus the web.config).

    Comment

    Working...