Export (0) Print
Expand All
0 out of 2 rated this helpful - Rate this topic

How to: Modify the Scope of Changesets and Work Items Associated With a Build Type

Visual Studio 2005

Changeset and work item association in Team Foundation Build are controlled by supplying labels to the GenCheckinNotesUpdateWorkItems task. The labels used are the label generated during the last successfully completed build and the label generated during the current build. The changesets associated with the build include:

  • The items in the label generated by the last successfully completed build.

  • The items in the label generated by the current build.

  • The changesets created anytime between the previously successful build and the current build.

The work items associated with the build are those associated with all these changesets.

This topic explains the steps that you must follow to override the CoreLabel target to change what is labeled, and therefore to control what changesets and work items are associated with build.

Prerequisites

Before you override the CoreLabel target, you must have the following:

  • Access to the TFSBuild.proj file of the build type you want to customize.

    Each team build type is defined by a TFSBuild.proj file that is located in the folder $/MyTeamProject/TeamBuildTypes/MyBuildName in Team Foundation source control. MyTeamProject is the name of your team project and is the root node of all your team project sources. MyBuildName is the name that you gave to your build type. For more information about how to create Team Foundation Build build types, see How to: Create a New Build Type.

  • A local workspace that contains your team project files and the build files on the local computer.

    For more information, see How to: Create a Workspace and How to: Get the Source for your Team Project.

  • The appropriate security permissions. For more information, see the following section.

Required Permissions

To perform this task, you must have the Administer a build and Administer workspaces permission set to Allow. You must also have the Check in and Check out permissions set to Allow. For more information, see Team Foundation Server Permissions.

Getting a Local Copy of the TFSBuild.proj File

Before you change the TFSBuild.proj file that defines your build type, you must get a local copy.

To get a local copy of TFSBuild.proj file

  1. On the View menu, select Other Windows, and then select Source Control Explorer.

  2. In Source Control Explorer, click Workspaces on the toolbar, and then select your workspace from the list.

  3. Open a team project folder that contains your build type, expand the TeamBuildTypes folder.

  4. Right-click the TFSBuild.proj file, and select Get Latest Version to copy the latest version of the file.

    For more information, see How to: Get the Source for your Team Project.

Overriding the CoreLabel Target in the TFSBuild.proj File

To specify the scope of the files that are built, override the Label task in the CoreLabel target.

To override the CoreLabel target

  1. Check out the TFSBuild.proj file and open it in the Visual Studio XML-editor.

    For more information, see How to: Check Out and Edit Source-Controlled Items.

  2. Define a value for a new property GetChangesetForFolder. Add the PropertyGroup definition to the end of the TFSBuild.proj file, before the closing </project> tag.

    </ItemGroup>
      <PropertyGroup>   
        <GetChangesetForFolder>Component1</GetChangesetForFolder>
      </PropertyGroup>
    </Project>
    

    The folder defined for GetChangesetForFolder must not include the team project folder. For example, if the folder that you want to define is $/teamproject/MyFolder/Component1, the GetChangesetForFolder property value is MyFolder/Component1.

    For more information about MSBuild PropertyGroups, see PropertyGroup Element (MSBuild).

  3. Add the CoreLabel target and Label task overrides directly after the PropertyGroup definition.

    </ItemGroup>
      <PropertyGroup>
        <GetChangesetForFolder>Component1</GetChangesetForFolder>
      </PropertyGroup>
      <Target Name="CoreLabel"
        Condition=" '$(IsDesktopBuild)'!='true' "
          DependsOnTargets="$(CoreLabelDependsOn)" >
        <!-- Label all the latest non deleted files in workspace -->
        <Label
         Condition=" '$(SkipLabel)'!='true' "
         Workspace="$(WorkspaceName)"
         Name="$(BuildNumber)@$/$(TeamProject)/$(GetChangesetForFolder)"
         Version="W$(WorkspaceName)"
         Files="$/$(TeamProject)/$(GetChangesetForFolder)"
         Recursive="$(RecursiveLabel)" />
      </Target>
    </project>
    

    Note the changes in Name and Files properties. These properties now contain the explicit scope to the Component1 folder.

  4. Click File, click Save to save your changes, and then close TFSBuild.proj.

  5. Check TFSBuild.proj back into source control. For more information, see How to: Check In Pending Changes.

  6. After you have modified the TFSBuild.proj file and saved the changes in Team Foundation source control, run the build type. For more information, see How to: Run a Build on a Build Type.

    Only the labeled files are built.

    Only the changesets specified by the labeled items, and the work items associated with these changesets, are associated with the build.

See Also

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.