Do not overwrite settings.settings file with clickonce

前端 未结 1 2016
灰色年华
灰色年华 2020-12-17 06:13

At first I had some userdefined settings stored in my app.config file, under appSettings. These are properties the user can change during runtime. The first problem I\'ve go

相关标签:
1条回答
  • 2020-12-17 07:04

    This method copies the settings from the previous installation when deploying a new version of the application with ClickOnce. So any user defined settings that the user made will be copied and thus available after the update. I tested this and it works for me.

    public static void UpgradeUserSettings()
    {
      if (Settings.Default.upgradeRequired)
      {
        Settings.Default.Upgrade();
        Settings.Default.upgradeRequired = false;
        Settings.Default.Save();
      }
    } 
    

    ApplicationSettingsBase.Upgrade Method MSDN

    other question on StackOverflow

    0 讨论(0)
提交回复
热议问题