Maintaining custom config sections accross application updates

Discussion in 'C#' started by KeithBoynton, Sep 3, 2010.

  1. KeithBoynton

    KeithBoynton New Member

    Joined:
    Sep 3, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    I have a Visual C# 2008 Express project which I deploy via ftp to a website using ClickOnce deployments.

    My application has a custom configuration section in app.config as shown below:

    Code:







    I'm loading and referencing the section like this:

    Code:
    ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
    fileMap.ExeConfigFilename = sConfigFilename;
    this.oApplicationConfiguration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
    this.oWatchConfig = (WatchConfiguration)this.oApplicationConfiguration.GetSection("WatchConfiguration");

    I have the config bound to various fields on a config form. Which all works fine.

    I save the config like this:

    Code:
    this.oConfigApplicationConfiguration.Save();

    This all works fine and persists the config accross application sessions.

    However, the configuration is lost on each publish of a new version of the application using ClickOnce deployments.

    I've googled and read numerous articles on persisting settings accross updates and all seem to reference "settings" which isn't really what I'm using. Maybe I should be.

    Any help would be greatly appreciated!!
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice