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:MSDeployServiceURL=https://<server name>:8172/msdeploy.axd

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


How to set up a build server for your TFS Hosting account

In this article, I will share with you on how to set up a build server for your TFS Hosting account.

Assume you have already signed up for a TFS hosting account. If not, you can go to TFS Hosting Sign Up to get one. Now please follow the steps below to set up a build server for your TFS hosting account.

1. Install TFS Build Service.

Download and run Visual Studio Team Foundation Server 2010 Setup. Since Dynamsoft has already set up the server side for you, you only need to choose the “Team Foundation Build Service” option. Then Click Install to install the service.

Team Foundation Setup

2. Start Build Service Configuration and click Next.

build service welcome

3. Project Collection

Then you’ll be guided to Project Collection to configure your Team Foundation Server info. Before configuring the connections, please add “ TFSServer1” to the hosts file on your build machine (under C:\Windows\System32\drivers\etc\). is the IP address of TFS server.

Then let’s go back to Project Collection. Click Browse… to select your team project collection. Since you haven’t connected to any TFS Server before, you can click Add in the “Add/Remove Team Foundation Server” dialog box to add a new one.

Name or URL of Team Foundation Server: tfsserver1
Path: tfs
Port number: 8080

After clicking OK, choose your team project collection. In this sample, we choose 105012.

4. Credential Settings

In the Run Team Foundation Build Service as section, choose “Use a user account” and enter the account name and password.

Please note that the account will be used to run the build service and connect to the Team Foundation Server, so please make sure:

a)      The account has the permission to run the build service. Usually you can choose the login user. In this case, I choose 105012_build.

b)      The same account exists on the TFS server. To double confirm this, you can log into your web portal and navigate to “TFS Hosted -> User Management”. If the user 105012_build is not there, you can click Create User to add the user. Please note that the password for the user should be the same on both machines.

c)        105012_build is in the “Project Collection Build Service Accounts” group. In Visual Studio, navigate to “Team -> Team Project Collection Settings -> Group Membership”. You can then choose “Project Collection Build Service Accounts” and click Properties to check the members. If the user is not in the list, please check out Can I add a Windows user to my TFS account for information on how to add.

For the port number, I choose the default one 9191. Please make sure it is not blocked by the firewall or any antivirus software on your build server.

5. Update Local Build Service Endpoint (incoming)

First, you need to stop the build service. To do this, you can open “Team Foundation Server Administrator Console” and click Stop in Build Configuration.

Then, click on Properties to change the value of Local Build Service Endpoint (incoming) from the machine name to your public network IP.

Note: please make sure that your firewall allows Microsoft Visual Studio Team Foundation Build Services to run both privately and publicly.

Done. Now you can get started to use your Build Server. If you have any questions or comments, please add them below or contact me at