In recent travels searching for deployment options using MSBuild, I have come across Microsoft’s Web Deployment Projects (WDP) add-on. This has been around forever (well, since 2005), but at the time it was released my work didn’t have much need for it.
WDP consists of a new utility (aspnet_merge.exe), some MSBuild tasks (Microsoft.WebDeployment.targets and DLL) and an add-in to VS 2005 that allows you to create a deployment project file from the VS 2005 UI. It does not actually require VS 2005 to be installed, so you can also install it on a build server.
Adding a Web Deployment Project to your solution simply creates an MSBuild project file (using the new WebDeployment tasks), so you can use it to complement existing MSBuild functionality you might have (such as scripts using SDC Tasks). Some of the options WDP gives you include compiling to a single or multiple assemblies, modifying web.config elements based on target configuration, creating IIS virtual directories for the output folder, pre- and post-build targets for customisation of the build process, and the ability to prevent the compiled web site from being updateable (no source-ASPX distributed to the server). Even if you do not use the VS add-in part of WDP, you can still get benefits from using the included MSBuild tasks as part of your normal build scripts.