Поделиться через


How to: Edit a Build Type

Prior to editing a build type, you must first create a build using the New Team Build Type Creation Wizard, for more information, see How to: Create a New Build Type. After a build type has been created, the build type will include an associated TFSBuild.proj file which is created and checked into Team Foundation source control under $<Team Project>\TeamBuild Types\<Build Type Name>\TFSBuild.proj. To edit the Build Type, the TFSBuild.proj file must be modified. The following procedure demonstrates how to edit a build type TFSBuild.proj file.

Required Permissions

To perform this procedure, you must have the Administer a build security permission set to Allow. Additionally, you must have the Check in permission set to Allow for the Team Build Types folder. For more information, see Team Foundation Server Permissions.

To edit a build type TFSBuild.proj file

  1. To edit an existing build type, the corresponding TFSBuild.proj file needs to be checked out. For more information, see Getting a Local Copy of Files from the Source Control Server.

  2. Right-click the TFSBuild.proj file and click Check Out for Edit. Once you have checked the file out for edit, double-click the file to open it in Visual Studio.

  3. In the TFSBuild.proj file, locate the Description section. If desired, edit the description by modifying the value in the Description element, for example:

    <Description>This is my new description</Description>
    
  4. Locate the SolutionToBuild element. For every solution that you want to include in the build type, a new SolutionToBuild element inside the ItemGroup element must be created. This specifies the solution name using the Include attribute, for example:

    <ItemGroup>
        <SolutionToBuild Include="$(SolutionRoot)\path\MySolution.sln />
        <SolutionToBuild Include="$(SolutionRoot)\Scribble\scribble.sln" />
        <SolutionToBuild Include="$(SolutionRoot)\HelloWorld\HelloWorld.sln" />
        <SolutionToBuild Include="$(SolutionRoot)\TestProject1\TestProject1.sln" />
    </ItemGroup>
    
  5. Locate the SolutionToBuild element. The order of the solutions is changed by modifying the order of the solutions specified in the ItemGroup element as described in the preceding step. If you need to move the HelloWorld solution above the Scribble solution as shown in the preceding step, make the following modifications:

    <ItemGroup>
        <SolutionToBuild Include="$(SolutionRoot)\TestProject1\TestProject1.sln" />
        <SolutionToBuild Include="$(SolutionRoot)\HelloWorld\HelloWorld.sln" />
        <SolutionToBuild Include="$(SolutionRoot)\Scribble\scribble.sln" />
    </ItemGroup>
    
  6. Locate the ConfigurationToBuild element. To add a new combination of configurations for debug and retail and platforms such as x86 and Itanium, add elements to the Compile target as shown below. In this example the user has a new combination of Debug and x86.

    <ConfigurationToBuild Include="Release|x86">
        <FlavorToBuild>Debug</FlavorToBuild>
        <PlatformToBuild>x86</PlatformToBuild>
    </ConfigurationToBuild>
    
  7. Locate the BuildMachine element. The build machine can be modified by editing the BuildMachine element, for example:

    <BuildMachine>machine1</BuildMachine>
    
  8. Locate the BuildDirectoryPath element. The build directory is modified by editing the BuildDirectoryPath element, for example:

    <BuildDirectoryPath>c:/builddir</BuildDirectoryPath>
    
  9. Locate the Drop Location element. The drop location is modified by editing the DropLocation element, for example:

                <DropLocation>\\machine2\drops</DropLocation>
    
    
  10. Locate the RunTest element. To modify the option of enabling test in the build process, edit the value of the RunTest element which can have either a true or false value, for example:

                <RunTest>true</RunTest>
    
    
  11. If you want to run selective tests, you can specify them with a Condition attribute. For example if you want to run the test for only "Debug|Any CPU" configuration, modify the corresponding MetaDataFile item and add the following condition:

    <MetaDataFile 
       Condition = ” ’$(Platform)’ == ’Any CPU’ and ‘$(Flavor)’ == ’Debug’ ”
       Include = ”$(SolutionRoot)\HelloWorld\HelloWorld.vsmdi”>
       <TestList>BVT1</TestList>
    </MetaDataFile>
    

    For more information on test metadata files, see Reusing Tests

  12. Locate the RunCodeAnalysis element. To change the option of enabling code analysis in the build process, modify the value of the RunCodeAnalysis element with Default, Always or Never value, for example:

                <RunCodeAnalysis>Never</RunCodeAnalysis>
    
    
  13. Save and check in the TFSBuild.proj file. Modifications to the file will affect the build type moving forward.

See Also

Concepts

MSBuild Project File Schema Reference
MSBuild Overview

Other Resources

Working with Build Types in Team Foundation Build
Customizing Team Foundation Build