Every .NET project I’ve worked on uses an app.config file for its configuration. Fair enough.
Today I am asking, “is there a better way?” (in the spirit of continual learning of course)
I guess my specific questions are:
- Does it matter either way if I use app.config or settings file?
- Are there any scenarios where settings files should not be used e.g web sites where you should use a web.config instead?
- Other than not having to edit xml, are there any other benefits gained by using settings instead of app.config, e.g. its easier to deploy or maintain apps etc.
Clarification:
I’ll put this question another way:
Can I completely ignore app.config files if I want to and keep all the configuration in a settings.cs file and interact with configuration via the designer only?
IMO, the main advantage of settings files is scoping (for client apps at least) – that is, that you can have different values of the same setting for a different user. It also allows you to easily edit and save user-scoped settings. And yes, if you don’t like editing XMLs – then settings have the advantage of a designer too 🙂