Bri Manning

Managing Web.configs for Multiple Environments

November 2, 2009

So, you’ve got your development environment, your QA environment and your production environment (at least!). What about the different databases they connect to? What about the different file paths or urls?

You don’t want a bunch of commented out sections of the config, that would be annoying, and you’d have to change them based on the environment.

What I like to do is rename the config based on the environment. So you can have you Web.dev.config, Web.qa.config or Web.production.config or similar. Simple as pie! Sure maybe there are more files in svn, but you only have to remember to rename the file when you deploy (or have it be part of your automated deployment procedure), which is definitely easier than working within the file itself.