ASP.NET Configuration File Handling

One of things I like the least about working with multiple development, QA, and production environments is messing around with configuration files to make sure the different versions point at the right databases.  Add the use of the Enterprise Library, and there are even more files to manage.

In my last year at Ciena, I worked in a group where they’d put together some code that detected what environment it was in (development, QA, or production) and retrieved the correct settings from web.config.  It was similar to the solution Mike Gunderloy describes in this article on ASP.NET 2.0 productivity.

When I was poking around for more information on config file handling, I came across another article that references Gunderloy’s that talks about a file attribute for the appSettings tag.  I hadn’t come across the existence of that attribute anywhere else before.  I’ll definitely use this on my next project.

Finally, this article provides another option for dealing with configuration files in multiple environments.  The code and examples are well-explained.  My group at Lockheed Martin should integrate something like this into the custom library we’ve been building.