Settings.settings
generates Settings.Designer.cs
which presumably generates app.config
which then is copied to output directory as Foo.exe.config
. When I distribute the application without the config file, nothing bad seems to happen. So, what is that file for?
4 Answers
If you don't have the config file, it uses the default values from the designer. However, the config file allows users/administrators to easily change settings - such as the server you talk to, themes, etc. If you don't have the file, where would you expect those settings to be stored?
You can have per-user settings as well as per-application settings, which are stored in different locations.
The config file is optional, if it does not exist environments such as ASP.NET will fall back to the machine.config file stored in the .NET system directories to get machine wide defaults.
If you actually add code to your app to retrieve settings from the config file (say using the ConfigurationManager class) and it does not exist, you will receive null values.
That is why it is important to check for this siutation and have your application make it's own decision on how/if to continue.