Suppose I have a .NET project that builds successfully. Now, I need to selectively build to different environments, such as DEV, QA, and PROD. Each require their own config files (app.config for instance) to contain corresponding connection strings and other settings.
I've looked at simple pre-build scripting, such as this one from Scott Hanselman. It works, but my problem is that the pre-build step modifies the source. Simply building the project will overwrite source files and unnecessarily trigger source control modifications.
I could also look into scripting outside of VS/MSBuild to put the config files in there after the deployment, but I'm really hoping there's still a better way. Perhaps a way that's self-contained in VS/MSBuild?
My deployment strategy to the target server is flexible. I've considered a setup project, which would require the configuration take place before the packaging. Or, an xcopy install is ok, too.
Ideas?