How to: Run Continuous Builds

The software practice of automated builds that trigger at frequent intervals or on each check-in is known as continuous integration. You can use Visual Studio Team System 2008 version of Team Foundation Build to run automated continuous integration builds. In addition to automated builds, you can use Team Foundation Build to test and run code coverage on the application that is being built. This enables you to test the application frequently and address problems as they occur. For more information about Test Edition, see Getting Started with Team System Testing Tools. For more information about code coverage, see Code Coverage Perspective, Walkthrough: Run Tests and View Code Coverage, and How to: Obtain Code Coverage Data.

Important noteImportant Note:

In order to run tests during a build, you must have Test Edition installed on the same computer as Team Foundation Build. In order to run code coverage during a build, you must have Development Edition installed on the same computer as Team Foundation Build.

Required Permissions

To complete this procedure, you must have the Administer a build permission set to Allow. Additionally, the application-tier service account and the Team Foundation Build service account must have read/write permissions to the build drop location. For more information, see Team Foundation Server Permissions.

To create a new build definition to run continuous builds

  1. In Team Explorer, select the project for which you want to create a new build definition.

  2. On the Build menu, select New Build Definition.

  3. Fill in the required information on the General and Workspace tabs.

    For more information, see How to: Create a Build Definition.

  4. On the Project File tab, click Create tocreate a new project file for your build definition.

    The MSBuild Project File Creation Wizard appears.

    1. On the Select and order solutions to build and Select configurations to build pages, fill in the required information.

    2. On the Select build options page, indicate the build options that you want to enable by selecting the Run test (e.g. run BVTs, etc.) and Perform code analysis according to project settings check boxes, as appropriate. If you select the Run test (e.g. run BVT's, etc.) check box, use the drop-down options to specify the Test metadata file and Test list to run as appropriate. Click Finish to return to the Project File tab of the Build Definition dialog box.

  5. Fill in the required information on the Retention Policy, and Build Defaults tabs.

    For more information, see How to: Create a Build Definition.

  6. Click the Trigger tab.

    1. Select Build each check-in (more builds) to build continuously every time a change is checked in to the files that are built by your build definition.

    2. Select Accumulate check-ins until the prior build finishes (fewer builds) to create rolling builds. If you select the Accumulate check-ins until the prior build finishes (fewer builds) check box, you can indicate how often builds take place by selecting the Build no more often than every check box and by entering a number in the minutes text box.

      The valid range for the minutes text box is 0 to 2147483647 (Int32 MaxValue, a predefined constant in the .NET framework).

    3. Select Build every week on the following days to create scheduled builds. Using the check boxes provided for each weekday, select each day on which you want to build. Enter the build time in the Queue the build on the default build agent at text box.

      Note

      If you have not checked in any changes since the previous build, the scheduled builds do not take place.

  7. Click OK to create your build definition once you have filled in all the required information.

    You can also create a batch file to run continuous builds from the command-line. For more information, see the Microsoft Web site (https://go.microsoft.com/fwlink/?LinkId=103671).

To edit an existing build definition to run continuous builds

  1. To edit an existing build definition, select the build definition from the Builds folder in Team Explorer.

  2. Right-click the build definition and select Edit Build Definition.

  3. Click the General, Workspace, Project File, Retention Policy, or Build Defaults tabs to review or change settings.

    For more information, see How to: Edit a Build Definition.

  4. Click Trigger to view the current build trigger for your build definition.

  5. To select a continuous integration trigger, follow these steps.

    1. Select Build each check-in (more builds) to build continuously every time you check in a change to the files that are built by your build definition.

    2. Select Accumulate check-ins until the prior build finishes (fewer builds) to create rolling builds. If you select the Accumulate check-ins until the prior build finishes (fewer builds) check box, you can indicate how often you want the builds to take place. To do this, select the Build no more often than every check box and enter a number in the minutes text box.

      The valid range for the minutes text box is 0 to 2147483647 (Int32 MaxValue).

    3. Select Build every week on the following days to create scheduled builds. Using the check boxes provided for each weekday, select each day on which you want to build. Enter the build time in the Queue the build on the default build agent at text box.

  6. Once you are satisfied with your build definition options, click OK on the Build Definition dialog box.

See Also

Reference

TestToolsTask Task

Other Resources

Working with Build Definitions in Team Foundation Build

Customizing Team Foundation Build