Using MSBuild to deploy website files

After reading several blogs and searching the net for examples, I finally finished our team build script. Some things to note about the tasks inside the build engine.

The delete task will not delete directories. The exclude path must be absolute.

$(SolutionRoot)\Projects\MyProject\branch_name MyProject.sln $(ProjectLocalPath)\MyProject.Web \\Server\share_name\_DeployFiles\branch_name

In order for this to work, the domain user that the Team Foundation Service runs under must have permissions to write and delete files and folders on the web server’s unc share.

Also you will need the MSBuild Tasks (http://msbuildtasks.tigris.org) to use the tasks. The files and zip are written to a _DeployFiles folder so they can be inspected and then copied to the server. This way we could control how, when, and who deploys the files.