When using a Settings.settings file in .NET, where is the config actually stored? I want to delete the saved settings to go back to the default state, but can't find where it's stored... any ideas?
10 Answers
It depends on whether the setting you have chosen is at "User" scope or "Application" scope.
User scope
User scope settings are stored in
C:\Documents and Settings\ username \Local Settings\Application Data\ ApplicationName
You can read/write them at runtime.
For Vista and Windows 7, folder is
C:\Users\ username \AppData\Local\ ApplicationName
or
C:\Users\ username \AppData\Roaming\ ApplicationName
Application scope
Application scope settings are saved in AppName.exe.config
and they are readonly at runtime.

- 6,138
- 12
- 49
- 61

- 31,807
- 12
- 70
- 78
-
21The folder for user scope settings on Vista and Win7 is C:\Users\username\AppData\Local\ApplicationName\Publisher\ApplicationName\Version or C:\Users\username\AppData\Roaming\ApplicationName\Publisher\ApplicationName\Version depending on the Roaming property value on Settings pane. – jakdep Jul 21 '10 at 10:35
-
4unless its an addin, in which case it will be AppName.dll.config – Anonymous Type Dec 03 '10 at 01:53
-
7My local user.config on Windows 7 is in C:\Users\
\AppData\Local\Publisher\ApplicationName_Eid_EvidenceHash\Version – The Lonely Coder Aug 13 '15 at 11:12
Here is the snippet you can use to programmatically get user.config file location:
public static string GetDefaultExeConfigPath(ConfigurationUserLevel userLevel)
{
try
{
var UserConfig = ConfigurationManager.OpenExeConfiguration(userLevel);
return UserConfig.FilePath;
}
catch (ConfigurationException e)
{
return e.Filename;
}
}
ApplicationSettings (i.e. settings.settings) use PerUserRoamingAndLocal for user settings by default (as I remembered).
Update: Strange but there are too many incorrect answers here. If you are looking for you user scoped settings file (user.config) it will be located in the following folder (for Windows XP):
C:\Documents and Settings\(username)\Local Settings\Application Data\(company-name-if-exists)\(app-name).exe_(Url|StrongName)_(hash)\(app-version)\
Url or StrongName depends on have you application assembly strong name or not.

- 30,738
- 21
- 105
- 131

- 9,447
- 1
- 32
- 43
-
Any idea what contributes to the hash in that path? Each subsequent release of my app is getting a different hash value, which makes calling ApplicationSettingsBase.Upgrade() futile. :/ – Mal Ross May 29 '15 at 14:01
-
2Hash is SHA1 hash of StrongName when app is signed or path when app is unsigned. More here https://msdn.microsoft.com/en-us/library/ms379611(v=vs.80).aspx – arbiter May 31 '15 at 23:08
Assuming that you're talking about desktop and not web applications:
When you add settings to a project, VS creates a file named app.config
in your project directory and stores the settings in that file. It also builds the Settings.cs
file that provides the static accessors to the individual settings.
At compile time, VS will (by default; you can change this) copy the app.config
to the build directory, changing its name to match the executable (e.g. if your executable is named foo.exe
, the file will be named foo.exe.config
), which is the name the .NET configuration manager looks for when it retrieves settings at runtime.
If you change a setting through the VS settings editor, it will update both app.config
and Settings.cs
. (If you look at the property accessors in the generated code in Settings.cs
, you'll see that they're marked with an attribute containing the default value of the setting that's in your app.config
file.) If you change a setting by editing the app.config
file directly, Settings.cs
won't be updated, but the new value will still be used by your program when you run it, because app.config
gets copied to foo.exe.config
at compile time. If you turn this off (by setting the file's properties), you can change a setting by directly editing the foo.exe.config
file in the build directory.
Then there are user-scoped settings.
Application-scope settings are read-only. Your program can modify and save user-scope settings, thus allowing each user to have his/her own settings. These settings aren't stored in the foo.exe.config
file (since under Vista, at least, programs can't write to any subdirectory of Program Files
without elevation); they're stored in a configuration file in the user's application data directory.
The path to that file is %appdata%\%publisher_name%\%program_name%\%version%\user.config
, e.g. C:\Users\My Name\AppData\Local\My_Company\My_Program.exe\1.0.0\user.config
. Note that if you've given your program a strong name, the strong name will be appended to the program name in this path.

- 94,622
- 24
- 146
- 218
-
1It looks like the My_Company component of the path will default to Microsoft. I've not yet found a way to change this that actually works, if someone knows that would be good to add. – Feb 06 '14 at 18:19
-
1user565869, have you tried in visual studio, open the project property's application tab, click the assembly information button and you should then be able to change Company? repeat that for each project in your solution – gg89 Sep 01 '16 at 21:51
While browsing around to figure out about the hash in the folder name, I came across (via this answer):
http://blogs.msdn.com/b/rprabhu/archive/2005/06/29/433979.aspx
(edit: Wayback Machine link: https://web.archive.org/web/20160307233557/http://blogs.msdn.com:80/b/rprabhu/archive/2005/06/29/433979.aspx)
The exact path of the
user.config
files looks something like this:
<Profile Directory>\<Company Name>\<App Name>_<Evidence Type>_<Evidence Hash>\<Version>\user.config
where
<Profile Directory>
- is either the roaming profile directory or the local one. Settings are stored by default in the localuser.config
file. To store a setting in the roaminguser.config
file, you need to mark the setting with theSettingsManageabilityAttribute
withSettingsManageability
set toRoaming
.
<Company Name>
- is typically the string specified by theAssemblyCompanyAttribute
(with the caveat that the string is escaped and truncated as necessary, and if not specified on the assembly, we have a fallback procedure).
<App Name>
- is typically the string specified by theAssemblyProductAttribute
(same caveats as for company name).
<Evidence Type>
and<Evidence Hash>
- information derived from the app domain evidence to provide proper app domain and assembly isolation.
<Version>
- typically the version specified in theAssemblyVersionAttribute
. This is required to isolate different versions of the app deployed side by side.The file name is always simply '
user.config
'.

- 1,136
- 1
- 13
- 16
-
Unfortunately the blog link is broken. I'm sure it would have been interesting. – UweBaemayr Jan 17 '19 at 18:09
It is in a folder with your application's name in Application Data folder in User's home folder (C:\documents and settings\user on xp and c:\users\user on Windows Vista).
There is some information here also.
PS:- try accessing it by %appdata% in run box!

- 30,738
- 21
- 105
- 131

- 40,053
- 20
- 133
- 188
Erm, can you not just use Settings.Default.Reset() to restore your default settings?

- 4,590
- 5
- 51
- 65
All your settings are stored in the respective .config file.
The .settings file simply provides a strongly typed class for a set of settings that belong together, but the actual settings are stored in app.config or a .config file in your application.
If you add a .settings file, an app.config will be automatically added to house the settings if you don't already have one.

- 7,227
- 29
- 34
If your settings file is in a web app, they will be in teh web.config file (right below your project. If they are in any other type of project, they will be in the app.config file (also below your project).
Edit
As is pointed out in the comments: your design time application settings are in an app.config file for applications other than web applications. When you build, the app.config file is copied to the output directory, and will be named yourexename.exe.config. At runtime, only the file named yourexename.exe.config will be read.

- 21,484
- 15
- 77
- 125
-
1Not correct. There is no app.config settings file in running application, because app.config will be renamed into [appname].exe.config. And anyway this file will contain only ApplicationScoped settings from settings.settins. – arbiter Jul 02 '09 at 16:18
-
@arbiter: Perhaps I missunderstood the question, but Adam appeared to be asking about the design-time defaults. Those are stored in app.config. At build-time, teh app.config file is copied to the build directory and renamed to (theapp.exe.config). However, if you edit that file directly (and are working in visual studio), you run the risk of the contents being overwritten the next time you build. Bottom line: For a deployed app (or if you are running outside the IDE), change teh name.exe.config file). If you are working in VS, change either the default value in settings, or app.config – JMarsch Jul 02 '09 at 17:55
Two files: 1) An app.config or web.config file. The settings her can be customized after build with a text editer. 2) The settings.designer.cs file. This file has autogenerated code to load the setting from the config file, but a default value is also present in case the config file does not have the particular setting.

- 24,142
- 15
- 92
- 130
I know it's already answered but couldn't you just synchronize the settings in the settings designer to move back to your default settings?

- 30,738
- 21
- 105
- 131

- 1,134
- 1
- 11
- 33