Is appname.exe.config required for user specific settings?
I'm building a simple winforms application which is using built-in settings for saving program options. All of the settings are per-user.
As I can see from the generated cs file the default settings are embedded in the source code but the application still reads the appname.exe.config file when launched. If I delete the file the application seems to be working fine but I want to make sure that it will not break anything.
So is the file required if I am only using per-user settings?
The settings designer embeds the default value in a [DefaultSettingValue] attribute. The following section in the Remarks section of the attribute is relevant:
Different settings providers may have different requirements or limitations on the use of the DefaultSettingValueAttribute. For example, the LocalFileSettingsProvider does not require this attribute, and will override any value provided by this attribute if there are any values—default or user-modified— already present in the data store.
LocalFileSettingsProvider is the default provider. So, it's there but it doesn't get used.
You should be using user settings instead of a configuration file. Refer to this article for more information, including how to read/write user settings.
If you are using the Application Settings
and you want persistence of the settings then yes this is where the options are saved. If you delete the file it will simply recreate it if the user changes a setting and you are setting the setting.