I’m using .NET user settings feature and I’m facing a problem.
When the application is uninstalled, then installed back, the user settings are lost.
I understand it’s by design, and I want to be able to give the choice to the user in the installer.
Could you please give me some pointers to articles or documentation that will helps me?
Thanks a lot
.NET User Settings are not removed on uninstall. In fact the settings of all previous versions of the software are preserved in Local Settings directory.
When the new version is installed, a new version of the settings is created and default settings are used.
To ensure your application will merge new settings with previous configuration, you have to call
Settings.Default.Upgrade()method.So the solution is to manually remove settings on uninstall if we don’t want to preserve them. Since what I needed was preserving previous settings, all I do now is creating a new setting called
UpgradeRequiredwithtruehas the default value, then add this code at application startup: