I am developing a WinForm application in VS 2003. I have placed the application settings in the App.config file. When I release a new version of the application, I want part of settings to get updated but not all of them. Right now, the install is replacing the old .config file with the new one.

I don't want the user to enter all the settings he entered earlier. Is there a way I can programmatically merge the new and old settings Do I have to use Custom Actions

Please suggest me if there is any other way through which this scenario can be handled! Also, is there any example I can look at


Re: ClickOnce and Setup & Deployment Projects Question on setup project


You could save (or do something with) the older settings file in an uninstall custom action in the old version of the setup. In an upgrade, this will get called before the file gets removed, so you could copy the settings to a known temp location. Then the new version can have an install custom action (which runs towards the end of everything that happens in the upgrade) that looks for the saved temp file and updates the settings into the newly installed config file.

You'd condition the uninstall custom action in the older version on UPGRADINGPRODUCTCODE (case-sensitive) because that's set when the older uninstall is being removed by an upgrade.