How to auto-deploy web application with TFS Build Server

Provided as part of Visual Studio Team Foundation Server, Team Foundation Build enables developers/managers to manage the projects, from version controlling the source code, running associated unit tests, to releasing builds and publishing build reports. In this article, I’ll share with you on how to take advantage of TFS Build to auto deploy a web application to your web server.

TFS Web Deploy

1. Install Visual Studio 2010. In this article, we take Visual Studio 2010 for example.

2. Install TFS Build Server.
You can set up a local build server by yourself. If you are using the TFS Hosting service provided by Dynamsoft, you can ask to install the Build Server add-on for your account.

3. Install Web Deployment Tool on your TFS Build Server.

4. Install Web Deployment Tool on your Web Server and set up the site for your web application.
Note: Please change the .NET Framework Version of the site’s application pool to v4.0 in IIS and make sure the firewall or any antivirus software doesn’t block port 8172.

5. Add the following arguments to the “MSBuild Arguments” of your build definition. Separate them using space.

TFS Build Arguments

/p:DeployOnBuild=True
/p:DeployTarget=MsDeployPublish
/p:MSDeployServiceURL=https://<server name>:8172/msdeploy.axd
/p:DeployIISAppPath=”TestSiteForDeploy”
/p:CreatePackageOnPublish=True
/p:MsDeployPublishMethod=WMSVC
/p:AllowUntrustedCertificate=True
/p:UserName=***
/p:Password=*****

To edit a build definition, you must have the Edit Build Definition permission. To set the permission, you can choose the target project in Team Explorer, and right-click Builds -> Security. In the Security dialog box, choose the user or group you want to grant the permission to, for instance, [DWT]\Builders. And then confirm the Edit build definition option is set to Allow.

TFS Build Security

With the above settings, the build result will be deployed to your web server automatically when you perform Queue New Build (Team Explorer -> right-click Builds -> Queue New Build).

It’s just a quick review of auto-deployment. Hope the information helps you enable the feature smoothly. If you have any comments, please don’t hesitate to leave them below for discussion. You can also reach me at kgao@dynamsoft.com.

 

  • Kevin Gao

    Hi Eric,
    Did you install VS 2012 on your Build Server machine?
    Kevin

  • http://www.kevingao.net/ Kevin Gao

    Hi Eric,

    Did you install VS 2012 on your Build Server machine?

    Kevin

  • http://www.kevingao.net/ Kevin Gao

    Hi Eric, please double check if you have edit permission to TFS 2012. I’m not quite sure about the MSBuild Arguments property from your end. Please verify your URL, port, path, ect.
    Regards

  • http://www.facebook.com/ezzman123 Eric Elliston

    I had this process working for over a year with VS 2010 with no real issue. I just upgraded to TFS 2012 with the same build scripts. The project compiles, but MSBuild seems to just ignore the deploy parameter and do nothing.

    Any Ideas for 2012?

    Thanks!