Udostępnij za pośrednictwem


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 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.

Two 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 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.

    Important noteImportant Note:

    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 new project file for a new build definition. For more information, see How to: Create a 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.

Also, these files are important:

  • TfsBuildService.exe.config

    You can use the TfsBuildService.exe.config file to configure certain aspects of Team Foundation Build. TfsBuildService.exe.config includes settings for the port you use to communicate with Team Foundation Server; for configuring the maximum number of processes used by Team Foundation Build; for generating errors and warnings per project, or per platform and configuration combination; and for modifying source, binaries, and test results subdirectory names on a build agent. For more information, see How to: Modify Settings in TfsBuildService.exe.config file.

    TfsBuildService.exe.config file is located in <root>:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies on an application-tier server.

  • 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. It 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 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 includes examples.

See Also

Tasks

Walkthrough: Customizing Team Foundation Build with a Custom Task

Other Resources

Customizing Team Foundation Build

MSBuild Concepts