此问题将继续How to keep Settings details in Visual Studio application?票证。
我试过跟随但是它将我的旧LocalSetting数据设置为空白。 Program.cs的
//get current version which is 1.1.0 after upgrade
string tempVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
tempVersion = tempVersion.Remove(tempVersion.Length - 2);
//tempVersion = 1.1.0
//it will check whether is new version installed
//Settings.Default.ProductCurrentVersion = 1.0.0. So, it will called
if (Settings.Default.ProductCurrentVersion != tempVersion)
{
MessageBox.Show("New Version: " +tempVersion);
MessageBox.Show("Old Version: " +Settings.Default.ProductCurrentVersion);
Settings.Default.Upgrade();
Settings.Default.Save();
//Local Settings data will be blank here.
}
有人可以提出我在这里缺少的东西吗?