Why are my application settings not getting persisted?

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

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


All user scope settings saved under application data with within a folder which indicates the version of your application and the name.

You can see these folders by clicking "synchronize" in your "application settings" dialog.

In Vista generally:

  • c:\users[currentuser]\AppData\Local[CompanyName][AppName]\version
  • c:\users[currentuser]\AppData\Roaming[CompanyName][AppName]\version

Done this way due to settings are related with current user and UAC. In Vista also you can see even the application-wide settings are not stored in the config file.

[CompanyName] and [ProductName] comes from your Assembly Information settings.