Why use app.config to store config data?

c#, configuration, settings

Solution

The main benefit of using the app.config is that it is the default, supported way for a .NET app to store its config. Anyone using that app or inheriting it from you some day will thank you for using established standards instead of "rolling your own".

Also, the .NET framework has support for using, writing, creating, modifying the app.config file - if you go with your own scheme, you'll have to re-invent the wheel many times over.

So I would definitely recommend using app.config - it's THE way to do configuration in .NET and a widely accepted and well-supported standard.

Marc

Problem

I am currently completing an application that was started by someone else. He is using the app.config for some settings, and a custom xml file for other parts. This drives me nuts, and I want to consolidate the configuration into one file. But I am not certain wether to move everything into the app.config and throw out the custom xml file, or move everything into the other file and forget about app.config. I can see two arguments, one for each option: - Using the standard way provided by Visual Studio is easier to maintain for somebody else than me. - I can validate the custom file against my own xml schema, thus outsourcing a lot of tests if the config file has all required data etc. But I'm certain that there are a lot more things than I can think of right now. That's why I'm asking: What are the advantages or disadvantages of using app.config for storing your configuration versus the 'traditional' configuration file?

Original source