Let\'s say you have a typical web app and with a file configuration.whatever. Every developer working on the project will have one version for their dev boxes, there will be
I have always kept all versions of the config files in source control, in the same folder as the web.config file.
For example
web.config
web.qa.config
web.staging.config
web.production.config
I prefer this naming convention (as opposed to web.config.production or production.web.config) because
The default config file should be configured such that you can run the application locally on your own machine.
Most importantly, these files should be almost 100% identical in every aspect, even formatting. You shouldn't use tabs in one version and spaces in another for indenting. You should be able to run a diff tool against the files to see exactly what is different between them. I prefer to use WinMerge for diffing the files.
When your build process creates the binaries, there should be a task that overwrites the web.config with the config file appropriate for that environment. If the files are zipped up, then the non relevant files should be deleted from that build.