Understanding Team Foundation Build Configuration Files

This topic explains the configuration files that are used by the Upgrade Template. For more information on the Upgrade Template, see Define a Build Using the Upgrade Template. The features that are used to produce these files, such as the MSBuild Project File Creation Wizard, are available only in Visual Studio Team System 2008.

When processing an Upgrade Template build, Team Foundation Build uses the MSBuild engine. The process is controlled by a set of XML files that correspond to the MSBuild project file schema. The following elements in these XML files are important to the build process:

  • Target element   The Target element defines how the project is built. Target elements contain a set of tasks that MSBuild runs sequentially. For more information about targets, see MSBuild Targets.

  • Task element   The Task element specifies the code that runs during the build process. For more information about tasks, see MSBuild Tasks.

    MSBuild includes a collection of common tasks you can use to customize the build process. For more information, see MSBuild Task Reference.

  • UsingTask element   The UsingTask element specifies the assembly that contains the tasks used in the build process.

MSBuild script files can import other script files. For example, you can define a common configuration in one file and then include it in other configurations. For more information, see How to: Use the Same Target in Multiple Project Files.

Three files control the Team Foundation Build process:

  • Microsoft.TeamFoundation.Build.targets

    This file defines the set of default tasks and targets included with Team Foundation Build. For example, Clean, DropBuild, and Compile. Each target contains the tasks to be called for that particular target. Some targets in this file depend on other targets to form a chain of targets to be executed in a particular order. For example, the target Compile depends on the target BeforeCompile so that any tasks defined in the target BeforeCompile are executed before Compile. Not all targets defined in this file are necessarily executed in every build. For example, desktop builds do not execute the Clean target.

    Microsoft.TeamFoundation.Build.targets is included with Visual Studio Application Lifecycle Management and can be found in the directory <root>:\Program Files\MSBuild\Microsoft\VisualStudio\TeamBuild\. There is only one copy of this file on a computer and it is shared by all builds that run on that computer.


    Do not modify Microsoft.TeamFoundation.Build.targets. If this file is modified, each build definition is affected. To customize build definitions, you must modify the TfsBuild.proj file associated with them.

  • TfsBuild.proj

    This is the main configuration file for Team Foundation Build. It can be associated with only one build definition or it can be shared by multiple build definitions. This file stores the configuration parameters you provide in the MSBuild Project File Creation Wizard. These include the team project, work item type created on build break, configuration to build, and solutions to build. The MSBuild Project File Creation Wizard creates this file when you create a project file for a new build definition. For more information, see Create a Basic Build Definition. This file imports Microsoft.TeamFoundation.Build.targets and it is passed to MSBuild. Any changes that you make to this file affect the builds of all the build definitions associated with it. This file is by default stored in source control under the folder $\MyProject\TeamBuildTypes\BuildDefinition where MyProject is the name of the team project and BuildDefinition is the name of the build definition. You can also store this file in a different location by specifying it in the Build Definition dialog box.

    The TfsBuild.proj file includes usage examples in comment text. These examples include how to call custom targets in the SolutionToBuild element and how to pass custom properties to other elements.

  • TfsBuild.rsp

    This is an empty file generated by the MSBuild Project File Creation Wizard. This file can be used to specify a custom logger or override MSBuild properties. For more information, see MSBuild Response Files.

Targets, Properties, and Tasks

The following topics describe the default targets, tasks, and properties that are defined in Microsoft.TeamFoundation.Build.targets.

  • Customizable Team Foundation Build Targets
    Lists the targets defined in Microsoft.TeamFoundation.Build.targets that you can override by writing custom tasks. This topic includes examples that illustrate how to customize the build process.

  • Customizable Team Foundation Build Properties
    Lists the default properties that are defined in Microsoft.TeamFoundation.Build.targets that you can override in the TfsBuild.proj file. This topic also includes examples.

  • Team Foundation Build Tasks
    Lists the default tasks defined in Microsoft.TeamFoundation.Build.targets that you can modify in the TfsBuild.proj file to customize build definitions. This topic also includes examples.