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


How to: Create a New Build Type

Team Foundation Build uses build types to configure the conditions under which a single solution or a set of solutions in a team project will be built. To conduct a build, you must either create a new build type or use an existing build type.

  • When you create build types by using the New Team Build Type Creation Wizard you can set several options. These options include running test or code coverage. Team Foundation has no user interface for changing these options after they are defined. To add your own build steps or change the build type, you can edit the TFSBuild.proj XML-file by using an XML editor. For more information, see How to: Edit a Build Type. You can override the default options by editing the build type file that is written in MSBuild format.

  • Build types are removed by deleting files directly from source control. For more information, see How to: Delete a Build Type.

Build types are created by using the New Team Build Type Creation Wizard, as described in the following procedure.

Required Permissions

To perform this procedure, you must have the Administer a build permission set to Allow. For more information, see Team Foundation Server Permissions.

To create a new build type

  1. In Team Explorer, select the project for which you want to create a new build type.

  2. On the Build menu, select New Team Build Type.

    The New Team Build Type Creation Wizard appears.

  3. In the New Team Build Type Creation Wizard, specify the name to associate with the build type in the What do you want to name this team build type text box.

    A validation is made to verify that the name entered already exists for an established build type. If the name exists, you are prompted to enter a unique name. Build type name must be a valid Windows file name and cannot contain $.

    Add an appropriate description in the Description text box and then click Next to continue.

    The Select and order solutions to build step is displayed.

    Tip

    The Next button is enabled only when all mandatory fields are correctly completed.

  4. In the From which workspace would you like to select solutions to build drop-down list box, select the workspace that contains the solutions you want to include in the build type. The option shows the workspace name and the user who created it.

  5. In the Select and order solutions list, select the solution or solutions that you want to add to the build type. By using the Select All option, you may select a single solution, several solutions or all solutions.

  6. Use the arrow keys to the right of the list to select the solutions and change their location in the build order. Solutions are built in order, starting at the top of the list.

    Warning

    Be aware of one solution having dependencies on another when you determine the order in which they are built. For example, if Solution2 has a dependency on Solution1, set Solution1 to be built before Solution2. When you are satisfied with the solutions you have selected and the order in which they are specified to build, click Next. The Select configurations to build step is displayed.

    Note

    If a branch operation is performed, the build types in the new branch must be edited to specify the correct paths. For more information, see How to: Update Build Types on Branched Team Projects and Branching and Merging Team Foundation Source Control.

  7. In the grid under Which configurations would you like to build, select the desired configuration and platforms to include in the build. The build configuration indicates the configuration and platform desired, for example, Retail and Any CPU.

    Note

    If a project uses a different configuration setting in the Configuration Manager than you specify in the New Team Build Type wizard, the project will be skipped.

    Note

    If you are creating a build type for Web projects, select Mixed Platforms.

  8. When you are satisfied with the build configuration selections, click Next.

    The Select build location step is displayed.

  9. In the text box for On which machine would you like to build the selected solutions, type the machine name, for example, MachineA_Lab1.

  10. In the text box for Build directory on selected machine, type the directory where you want the build to occur. This is a local directory on the build machine. For example, D:\AdventureWorks\TourPackeServices\.

    Warning

      When selecting the build directory, make sure there is sufficient space to build. Insufficient space will lead to failed builds.

    Note

    The build directory cannot be a mapped directory.

  11. In the Drop Location text box, either type the UNC (\\server\share) location, or use Browse to search for a drop location. The drop location is where the built binaries and log files will be located as soon as the build finishes.

    • By default, the drop directory is not automatically created as a share and therefore is not available for publishing builds and test results. You must manually establish a share. To avoid unauthorized users from deleting build drops, it is not recommend establishing delete permissions on the share.

    • Each generated build will be dropped into a separate directory. You will have to ensure that the account with which build machine is configured has write access to this UNC location. Also, the write permission is required to the account under which the application tier is configured.

    Warning

      Built binaries and log files copied to the drop directory might not be secure. You can extend the build type with a custom MSBuild task that securely copies these files to the drop directory. For more information about how to extend a build type, see Walkthrough: Customizing Team Foundation Build with a Custom Task.

  12. When you are satisfied with the build location settings, click Next.

    The Select Build Options step is displayed.

  13. Indicate the build options that you want to enable by selecting the Run test (e.g. run BVTs, etc.) and Run code analysis check boxes, as appropriate. If the Run test (e.g. run BVTs, etc.) check box is selected, use the drop-down options to specify the Test metatdata file and Test list to run as appropriate. For more information, see Using Test Lists and Writing Quality Code.

  14. When you are satisfied with the build steps, click Next.

    The Review Build Type selections step is displayed.

  15. If you are satisfied with the build type, click Finish. The new build type creates the underlying files. The files created are:

    • TFSBuild.proj

    • WokspaceMapping.xml

    These files are checked into Team Foundation source control under the folder that has the same name as “build type.” For example, if you create a build type named “myBuildType,” in Team Foundation source control, the files are stored at $/[Team Project Name]/TeamBuildType/myBuildType.

    Note

    If you want to continue to edit the build type, you will have to edit the TFSBuild.proj file.

    With the wizard steps completed, you must now make sure that the correct permissions are in place for the build type you just created. For more information, see How to: Establish Permissions for Team Foundation Build Computer.

See Also

Tasks

Walkthrough: Creating a Build Type in Team Foundation Build
How to: Establish Permissions for Team Foundation Build Computer
How to: Set Up a Build Computer
Walkthrough: Customizing Team Foundation Build with a Custom Task

Concepts

Overview of Team Foundation Build

Other Resources

Working with Build Types in Team Foundation Build