I believe you just need to add the package target to your build for the web project.
/t:Build;Package
I use this target in my tfs assembly to create a _PublishedWebsite zip folder for a while with success.
EDIT: Explaining the purpose of the package If you look at your csproj file for your web application as an XML file, you will see that it includes the following
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
This includes many web goals during the build process. Hack this file open, and at the bottom you will see that it, in turn, includes
<Import Project="..\Web\Microsoft.Web.Publishing.targets" Condition="Exists('..\Web\Microsoft.Web.Publishing.targets')" />
This file contains the definition of the web deployment process for MSBuild. You will see that it declares a variable to designate the "target" to be called in Deploy as "package"
<DeployDefaultTarget Condition="'$(DeployDefaultTarget)'==''">Package</DeployDefaultTarget>
If you read this file later, it will give you an idea of how packaging and deployment work under covers, and what set of properties and goals you can manipulate to customize your build.
In short, if you call
msbuild yourwebapplication.csproj /t:Package /p:Configuration=Release
It should create a web deployment package for you to configure the Release of your application.
source share