One can easily use ApplicationSettingsBase class to manage application settings on user or application level. When used with user scoped settings, configuration values will be lost with version upgrades. We can use following code at application launch to update configuration values from old configuration file.
String strVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
if (Properties.Settings.Default.CurrentVersion != strVersion) {
Properties.Settings.Default.Upgrade();
Properties.Settings.Default.CurrentVersion = strVersion;
}
No comments:
Post a Comment