Udostępnij za pośrednictwem


Team Foundation Build Tasks

The MSBuild tasks are contained in targets. These tasks provide the code that runs during the build process. MSBuild provides a library of common tasks. For more information, see MSBuild Task Reference.

The MSBuild .targets file for Team Foundation Build, Microsoft.TeamFoundation.Build.targets defines several default Team Foundation Build tasks that you can customize by setting properties in the TfsBuild.proj file. For example, the CoreGet target includes a Get task that enables you to retrieve a specific changeset for a build type. By default, the Get task retrieves the latest files. For more information about .targets files, see MSBuild .Targets Files.

List of Default Tasks in Microsoft.TeamFoundation.Build.targets

The following tasks can be customized by modifying their properties.

Team Foundation Build Task

Associated target

Get Task

Synchronizes the sources on the build computer. It also raises log events to inform the logger of every file and version retrieved into the local workspace.

Get

Label Task

Labels all source files of a specified workspace.

Label

GenCheckinNotesUpdateWorkItems Task

Generates the list of all changesets and work items that were created or affected during a build. Labels are used to tag a particular build.

GetChangeSetsAndUpdateWorkitems target is invoked if the build is successful.

GetChangeSetsOnBuildBreak target is invoked if the build is not successful.

CreateNewWorkItem Task

Creates a new work item for failures that occur during the build process. Also, it updates the Found In field in the work item with a link to the specific build number.

CreateWorkItem

CreateWorkspaceTask Task

Creates a new workspace on the build computer.

InitializeWorkspace

DeleteWorkspaceTask Task

Deletes the workspace created during the build execution. The actual files are not deleted from the build computer. If the specified workspace does not exist, DeleteWorkspaceTask issues a warning.

InitializeWorkspace

UpdateBuildNumberDropLocation Task

Creates a folder at a specified location to receive the built files. Also, it updates the build number.

InitializeEndToEndIteration

TestToolsTask Task

Runs a set of tests during the build and publishes the results.

RunTestWithConfiguration

BuildStep Task

Inserts the build steps into the build.

None

GetBuildProperties Task

Outputs the initial values for the build properties.

InitializeBuildProperties

SetBuildProperties Task

Sets any property on the build that can be set.

None

WorkspaceItemConverterTask Task

Converts the version control server items to local workspace items, and local items to version control server items.

ResolveSolutionPathsForEndToEndIteration and ResolveTestFilesForEndToEndIteration

Modifying Team Foundation Build Tasks

To modify the tasks defined in the definition file Microsoft.TeamFoundation.Build.targets, examine the properties of the task you want to modify, and then specify those properties in the TfsBuild.proj file for your Team Foundation Build build type. The CreateNewWorkItem task is defined as follows.

<!-- Create WorkItem for build failure -->
    <CreateNewWorkItem
          BuildId="$(BuildNumber)"
          Description="$(WorkItemDescription)"
          TeamProject="$(TeamProject)"
          TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
          Title="$(WorkItemTitle)"
          WorkItemFieldValues="$(WorkItemFieldValues)"
          WorkItemType="$(WorkItemType)"
          ContinueOnError="true" />

To customize the work item that is created when a build fails, set the WorkItemFieldValues in the TFSBuild.proj file:

Note

The following assumes that the Areapath and IterationPath properties have also been set.

<WorkItemFieldValues>Area Path=$(AreaPath);Iteration Path=$(IterationPath);Severity=1;Priority=0;Symptom=build break;Steps To Reproduce=Start the build using Team Build;Source=Development;How Found=Build Break;Assigned To=Active</WorkItemFieldValues>

See Also

Tasks

How to: Use Environment Variables in a Build

Concepts

Understanding Team Foundation Build Configuration Files

Customizable Team Foundation Build Properties

Customizable Team Foundation Build Targets