When you create suppose C# Winform application and go to project properties there is this tab called settings which allows you to store some variables. so when user closes application and runs it again those values would not be lost. So as I guess somewhere some file is created to store the values declared in settings tab. Does anybody know where this file is located at?
-
1have you tried google ? or tried to enter some settings and then to look for a file or the .csproj main file ? – ilansch Feb 09 '14 at 16:49
-
It depends on how you build your application, but these are sent to the /bin/debug or /bin/release folder by default when you build a winforms application. Tons and tons of information on MSDN you can find by typing your *exact title* in google. Which should have been your first stop. – Evan L Feb 09 '14 at 16:49
-
possible duplicate of [Where are the Properties.Default.Settings stored?](http://stackoverflow.com/questions/982354/where-are-the-properties-default-settings-stored) – Ove Feb 09 '14 at 16:51
-
2I tried. I could not find it. that's why I asked. thank anyways – Dimitri Feb 09 '14 at 17:16
-
1possible duplicate of [Settings in VB.NET](http://stackoverflow.com/questions/17244665/settings-in-vb-net) – Hans Passant Feb 09 '14 at 17:22
1 Answers
If you tried to add settings you wanted to persist, you would have been able to see them in
YourApp.exe.config
file which is in the same directory where is build output binary.
For settings like this:
...WindowsFormsApplication1.exe.config
file (generated by the Visual Studio and placed in the same directory where it output WindowsFormsApplication1.exe
) contains settings you added:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="WindowsFormsApplication1.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="WindowsFormsApplication1.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<userSettings>
<WindowsFormsApplication1.Properties.Settings>
<setting name="UserSetting" serializeAs="String">
<value>UserValue</value>
</setting>
</WindowsFormsApplication1.Properties.Settings>
</userSettings>
<applicationSettings>
<WindowsFormsApplication1.Properties.Settings>
<setting name="AppSetting" serializeAs="String">
<value>AppValue</value>
</setting>
</WindowsFormsApplication1.Properties.Settings>
</applicationSettings>
</configuration>
From MSDN's Application Settings Architecture:
- Application-scoped settings can be stored in either the machine.config or app.exe.config files. Machine.config is always read-only, while app.exe.config is restricted by security considerations to read-only for most applications.
- User-scoped settings can be stored in app.exe.config files, in which case they are treated as static defaults.
- Non-default user-scoped settings are stored in a new file, user.config
Further down you can see file locations:
The location of the app.exe.config and user.config files will differ based on how the application is installed. For a Windows Forms-based application copied onto the local computer, app.exe.config will reside in the same directory as the base directory of the application's main executable file, and user.config will reside in the location specified by the Application.LocalUserAppDataPath property.

- 9,216
- 2
- 41
- 51