How to maintain user.config settings when upgrading

傅志诚
2023-12-01

http://bytes.com/topic/c-sharp/answers/522191-how-maintain-user-config-settings-when-upgrading

Add a Setting to your project called ApplicationVersion, then use code like

the following in the startup of your applicaiton:

System.Reflection.Assembly a =
System.Reflection.Assembly.GetExecutingAssembly();
Version appVersion = a.GetName().Version;
string appVersionString = appVersion.ToString();

if (Properties.Settings.Default.ApplicationVersion != appVersion.ToString())
{
Properties.Settings.Default.Upgrade();
Properties.Settings.Default.ApplicationVersion = appVersionString;
}
 类似资料:

相关阅读

相关文章

相关问答