Understanding Team Foundation Build Configuration Files

Team Foundation Build uses the MSBuild engine. The Team Foundation Build 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 will run during the build process. For more information about tasks, see MSBuild Tasks.

  • MSBuild includes a collection of common tasks that can be used 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.

Several 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 Team System. It can be found in the directory MSBuildExtensionsPath\Microsoft\VisualStudio\v8.0\TeamBuild\. There is only one copy of this file on a computer. It is shared by all builds running on that computer.

    Important

    Do not modify Microsoft.TeamFoundation.Build.targets. If you modify this file, it affects each build type. To customize individual build types, you must modify the TfsBuild.proj file.

  • TfsBuild.proj

    This is the main configuration file for Team Foundation Build. There is one file for each build type. This file contains the configuration parameters you provide in the New Team Build Type Creation Wizard. These include the build computer, the directory in which to build, the drop location, and the solutions to build. The New Team Build Type Creation Wizard creates this file when a user defines a new build type. This file imports Microsoft.TeamFoundation.Build.targets and is passed to MSBuild. Any changes that you make to this file affect the builds of this build type. This file is stored in source control under the folder $\MyProject\TeamBuildTypes\BuildType where MyProject is the name of the team project and BuildType is the name of the build type.

  • TfsBuild.rsp

    This is an empty file generated by the New Team Build Type Creation Wizard. You can use this file to specify custom logger or override MSBuild properties. For more information, see MSBuild Response Files.

  • WorkspaceMapping.xml

    Team Foundation Build uses the WorkspaceMapping.xml file to create its workspace. This file is stored in source control under the folder $\MyProject\TeamBuildTypes\BuildType where MyProject is the name of the team project and BuildType is the name of the build type.

Targets, Properties, and Tasks

The following topics provide more information about 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. It includes examples that illustrate how to customize the build process.
  • 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 the build type. It provides examples.

See Also

Tasks

Walkthrough: Customizing Team Foundation Build with a Custom Task

Other Resources

Customizing Team Foundation Build
MSBuild Concepts