Right now our test and production databases are on the same server, but with different names. Deploying has meant editing Web.config to change all the connection strings for th
Use a Web Deployment Project and update the wdproj file (it's just an MSBuild file) with some post build tasks to output the correct .config file. I keep a web.config and web.release.config then use this in the wdproj file:
More information
A simpler solution some like is using configSource property of appSettings and connectionStrings and then never overwriting that file on the production server.