How to retain application settings in the xml config file (?.config) in every installation?

Posted on 2012-08-30
Last Modified: 2013-12-16
Hi experts
I am writing an application in C# .NET 3.5, Winform. I have one setting stored in the application settings (under 'Settings.settings'). These settings are saved in an xml config file.

Upon every new installation, the content in the xml config file is overwritten. But there is one particular setting I would like to keep. Is it possible to do that?

Thanks in advance.
Question by:dominicwong
    LVL 23

    Expert Comment

    by:Roopesh Reddy

    it toally depends on the Installation program you are using!

    You need to do some settings in the Installation program, so that it won't remove while uninstalling and it won't overwrite when installing!!!

    Hope it helps u...

    Author Comment

    Thanks roopeshreddy.
    I am not sure whether you meant the setting 'RemovePreviousVersions'.

    What I want is to keep only the 'Settings.settings' but remove the other things. It is because I still want user to install a new version on top of an old version. The only thing I would like to keep is the 'Settings.settings'.
    LVL 23

    Expert Comment

    by:Roopesh Reddy

    No! That option will remove or retain the entire version!

    You are looking for particular file, so you may need to set that option for specific file only!

    Moreover, which Installation program are you using?

    Author Comment

    I am using VS2008. The installer project is part of the standard VS2008 template.

    Accepted Solution

    Seems like MSI overwrites it automatically. There is one possible way:

    Author Closing Comment

    close question due to lack of response

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
    Introduction In my previous article ( I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    This video discusses moving either the default database or any database to a new volume.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now