Why are my application settings not getting persisted?

后端 未结 3 1693
不知归路
不知归路 2020-12-03 21:31

So I have some settings that are of the user scope, but for some reason, they are not being saved to the .exe.config file. I do the following:



        
3条回答
  •  北海茫月
    2020-12-03 21:56

    If you have your Assembly info set to automatically generate any version numbers (1.0.*), then every time you debug your app the version number will be different, and so will be creating a new file every time.

    If this is the case you will need to perform an upgrade on the settings file:

    Properties.Settings.Default.Upgrade()
    

    You can also set a setting of NeedsUpgrading to true by default and set it to false after performing an upgrade so that end users who are not changing version numbers every time the app is started will not be Upgrading all the time

提交回复
热议问题