Single config file - multiple deployment environments (i.e. dev, qa, prod)
A common problem most application developers face at one time or another is managing the deployment of the environment specific configuration elements their application depends on. Most often these elements include items like connection strings, file paths or other settings the application requires access to during runtime. I recently tackled this problem and came up with a solution that seems to work pretty well (we have been using it for the past 4 months without any issues) and fits in great with our automated build enviornment. Download code (http://mattberseth.com/downloads/managing_environment_config_settings.zip) for this article. My approach was pretty simple. I wanted the build process to substitute all of the environment specific config settings while it was making the build. So if I was doing a regular build at my desk, Visual Studio would automatically use the 'dev' environment settings, but when the automated build server did a 'qa' or 'prod' build, the correct settings would be applied here as well. 1. First I identified...