Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where are user-mode .NET settings stored?

Tags:

.net

settings

I'm wondering what is the magic behind .settings files in .NET. Imagine you create an assembly called in this example SettingsHolder, you create your settings class which is public with a string inside in user mode , then you compile.

Now you reference your assembly in MyApp, you compile then you can change the value in your application of your setting with the settings class generated in SettingsHolder and persist them.

Now go in the output directory of MyApp and there is no trace of your setting (nothing in the application configuration file, nothing in the assembly, nothing !).

What is going on?! (I have tried to source step debug in .NET source, and reflector to see what is happening, .NET seems to use LocalFileSettingsProvider (but it seems weird to me because there is nothing in MyApp.exe.config in the output directory).

like image 999
Nicolas Dorier Avatar asked Jan 22 '09 16:01

Nicolas Dorier


People also ask

Where are user settings saved C#?

User settings are saved in a file within a subfolder of the user's local hidden application data folder.

Where are Windows user settings stored?

Select View > Options > Change folder and search options. Select the View tab and, in Advanced settings, select Show hidden files, folders, and drives and OK. Was this reply helpful? Your user settings are stored in many places throughout Windows.

Where is Visual Studio user settings?

Settings. settings is located in the My Project folder for Visual Basic projects and in the Properties folder for Visual C# projects. The Project Designer then searches for other settings files in the project's root folder.

Where are application settings stored?

User-scope settings are stored in the user's appdata folder. Application-scope settings are stored in C:\Users\My Name\AppData\Local\My_Company\. If your settings file doesn't contain any Application-scope settings, you won't have a company folder.


1 Answers

The setting files are stored in a different place for each user. To find them, click the start menu, click run, and paste:

%USERPROFILE%\Local Settings\Application Data\ 

and press enter. There will be a folder with your "Company Name" (whatever it is set to in your assembly) and then some more subfolders. The settings are stored in user.config.

Full path:

%USERPROFILE%\Local Settings\Application Data\<Company Name>\ <appdomainname>_<eid>_<hash>\<verison>\user.config. 

In Windows Vista and newer, these are stored under:

%USERPROFILE%\AppData\Local\ 

More info:

  • http://www.codeproject.com/KB/vb/appsettings2005.aspx
  • http://www.google.com/search?q=.net+user.config
like image 192
ine Avatar answered Sep 18 '22 05:09

ine