Team Foundation Build Tasks
MSBuild tasks are contained in targets, and provide the code that runs during the build process. A library of common tasks is provided with MSBuild. For more information, see MSBuild Task Reference.
Microsoft.TeamFoundation.Build.targets defines several default Team Foundation Build tasks that you can modify by setting their properties in the TfsBuild.proj file to customize certain actions. 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.
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 |
---|---|
This 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. |
CoreGet |
This task labels all source files of a specified workspace. |
CoreLabel |
GenCheckinNotesUpdateWorkItems Task This task generates the list of all changesets and work items which were created or affected during a build. Labels are used to tag a particular build. |
GetChangeSetsAndUpdateWorkitems target is invoked if the build is succesful. GetChangeSetsOnBuildBreak target is invoked if the build is not succesful. |
This task creates a new work item for failures during the build process. The Found In field in the work item is updated with a link to the specific build number. |
CreateWorkItem |
This task creates a new workspace on the build computer by using the workspacemapping.xml file. |
InitializeWorkspace |
This task deletes the workspace that was 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 This task creates the drop folder at drop site and updates the build number. |
InitializeEndToEndIteration |
This task runs a set of tests during the build and publishes the results. |
RunTestWithConfiguration |
Modifying Team Foundation Build Tasks
To modify the tasks defined in Microsoft.TeamFoundation.Build.targets, examine the properties of the task that you want to modify, and set those properites in the TfsBuild.proj file of 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 on build failure, you 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: Modify the Scope of Changesets and Work Items Associated With a Build Type
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