How to: Update Build Definitions on Branched Team Projects

Branching with Team Foundation version control copies all the folders and files, including the TeamBuildTypes folder, from a previous branch to a destination branch. For more information, see Branching and Merging Team Foundation Version Control. There are two branching scenarios to consider that affect team build types in different ways:

  • Partial branch   When a team project folder that contains several solutions has only one or some of the solutions branched.

  • Complete branch   When a team project folder is branched in its entirety.

With a partial branch, the build definitions contained in the TeamBuildTypes folder will still be valid for their original configuration. In other words, they will run against the original branch. With a partial branch, it is recommended that you create new build definitions, where necessary, that point to the solutions in both the original branch and the new branch. For more information, see How to: Create a Build Definition. Although you could modify the existing TFSBuild.proj files in the new branch to point to the appropriate paths, by creating new build definitions you retain the original build definitions that you can still use on the previous pre-branched configuration.

As with a partial branch, when you create a complete branch within a team project you make a copy of the original TeamBuildTypes folder in Team Explorer. The build definitions contained in the folder in the new branch will not automatically work against the new branch. As with a partial branch, it will run against the original branch paths. In this case, it is recommended that you modify the paths to the solutions in the TFSBuild.proj files to point to the correct folder.

Required Permissions

To update build definitions on branched team projects, you must have the Administer a build permission set to Allow. Additionally, you need the Check out permission set to Allow for the Team Build Types folder. For more information, see Team Foundation Server Permissions.

Procedure

To edit a TFSBuild.proj file to update build definition paths because of a complete branch operation

  1. To edit an existing build definition to update the path to the solution, check out the corresponding TFSBuild.proj file.

    For more information, see Getting a Local Copy of Files from the Version Control Server.

  2. Right-click the TFSBuild.proj file in Source Control, and then select Check Out for Edit.

  3. Double-click the TFSBuild.proj file to open it in Visual Studio.

  4. In the TFSBuild.proj file, locate the <ItemGroup> tag. Within the <ItemGroup> tag, update the path in each SolutionToBuild tag, as shown in the following example.

    Original file copied from Team Project Folder Alpha:

    <ItemGroup>
        <SolutionToBuild Include="$(SolutionRoot)\Alpha\path\Solution1.sln" />
        <SolutionToBuild Include="$(SolutionRoot)\Alpha\path\Solution2.sln" />
    </ItemGroup>
    

    Modifications to reflect new branched called Beta:

    <ItemGroup>
        <SolutionToBuild Include="$(SolutionRoot)\Beta\path\Solution1.sln" />
        <SolutionToBuild Include="$(SolutionRoot)\Beta\path\Solution2.sln" />
    </ItemGroup>
    
  5. Save the TFSBuild.proj file and check it in to source control.

    Modifications to the updated paths in the file will affect the build definition moving forward. If the TFSBuild.proj file is associated with more than one build definition, the updated paths will affect all the definitions.

See Also

Other Resources

Running Builds in Team Foundation Build