I am deriving from ApplicationSettingsBase to store our users settings, however when the build number gets incremented the app uses a new settings folder, and so the old settings are lost. What is an appropriate way to deal with the situation of shared settings over different build numbers.
Have a User setting called Upgraded, boolean that defaults to false. Then do a check:
if (!Properties.Settings.Default.Upgraded)
{
Properties.Settings.Default.Upgrade();
Properties.Settings.Default.Upgraded = true;
Properties.Settings.Default.Save();
Trace.WriteLine("INFO: Settings upgraded from previous version");
}
This will upgrade the settings from the previous version if it's the first run of the new version.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.