How to: Start a Build from the Command Line

You can use the TFSBuild start command to start a configured Team Foundation Build type from the command line.

Starting a build from the command line is a useful way of running timed builds by including them in batch or script files. Before you run the TFSBuild start command, you must have the following information:

  • Name of the team project that contains the solution you want to build

  • Name of the Team Foundation Build build definition

  • URL of the Team Foundation server

The following information is optional:

  • Name of the computer where the solutions are built

  • Directory where the build files are stored


    If you do not provide values, the default values for the build definition are used.

For more information, see Start Command (Team Foundation Build).

Required Permissions

To complete this procedure, you must have the Team Foundation Server Start a build security permission set to Allow. For more information, see Team Foundation Server Permissions.

The following procedure demonstrates the command-line syntax for starting a Team Foundation Build type.

To start a build definition from the command-line

  1. Click Start, click All Programs, point to Microsoft Visual Studio 9.0, point to Visual Studio Tools, and then click Visual Studio 2008 Command Prompt.

  2. At the command prompt type:

    <root>:\>TFSBuild start http://server01:8080 AdventureWorks Nightlies 

    Where the Team Foundation Server is the server specified by the build definition, "Nightlies" and the built files are saved in the build drop location, which is also specified by the build definition. The <root> specifies the drive, usually "C". The "http://server01" specifies the URL for the Team Foundation server, "AdventureWorks" specifies the team project, and "Nightlies" specifies the build definition.

Setting Up a Scheduled Build

The Team Foundation user interface in Team Foundation Server does not include an ability to run scheduled builds. However, you can access that functionality by using the Windows Task Scheduler service and the TFSBuild start command.

Community Additions