Visual Studio - Solution Configurations and Tasks
You can have multiple configurations for the given Visual Studio Solution. Similarly projects in the solution can have multiple configurations, and you map them to particular solution configuration. With project's different configuration, you can setup associated tasks! For example, you have a staging and production server..you want to deploy the project(s) to staging or production server depending what configuration of the solution you are building...this is how you will do this step by step!
First create solution configuration(s)
I have unchecked creating new project configurations, as I want to create new project configuration for one (or few projects) and not all projects
Then create project configuration for particular solution configuration!
I have unchecked here the create new solution configuration option, as I already have made one
Now lets create few tasks that deploy the project items to the server, we will first unload the project so that we can edit the *.*PROJ file and then edit the project file by hand...
I am now writing the tasks that will get executed conditionally (depending on what solution/project configuration you are building)...I am calling my conditional target in afterbuild target, i-e after build is completed, my tasks will get executed (conditionally)...
I am using FtpUpload task from MSBuild Community Tasks, using which I can even upload the project items to production server's ftp location!
Once things are setup, simply choose required solution configuration and build!
Pushing things to staging/production servers becomes just be one build away...