Why are my application settings not getting persisted?

后端 未结 3 1700
不知归路
不知归路 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:49

    User settings are specific to the user, so they wouldn't get saved back to the .exe.config file, which is system wide.

    From the docs of LocalSettingsProvider:

    Application-scoped settings and the default user-scoped settings are stored in a file named application.exe.config, which is created in the same directory as the executable file. Application configuration settings are read-only. Specific user data is stored in a file named username.config, stored under the user's home directory.

    So for a UserSettingsTest application just run from VS under the debugger (hence the vshost bit) I ended up with a path of:

    C:\Users\Jon\AppData\Local\UserSettingsTest
      \UserSettingsTest.vshost.e_Url_pdqoppugkz1vaawbhwkkcu5ibxpi2fgu
      \1.0.0.0\user.config
    

提交回复
热议问题