Sdílet prostřednictvím


Create a Basic Build Definition

After you put a build system in place (as described in Configure Your Build System), you are almost ready to start using Team Foundation Build to compile your code, run your tests, and perform many other important functions. The next step is to create a build definition. A build definition contains your instructions about which code projects to compile, which additional operations to perform, and how to perform them.

Required Permissions

To perform this procedure, you must have the Edit Build Definition permission set to Allow. For more information, see Team Foundation Server Permissions.

To create a build definition

  1. In Team Explorer, click the team project for which you want to create a build definition.

  2. On the Build menu, click New Build Definition.

    The New Build Definition window appears with the General tab displayed.

  3. In the Build definition name box, specify the name to associate with the build definition.

  4. In the Description box, add an appropriate description.

    This description provides additional information to people on your team when they are about to manually queue a build (as described in Queue a Build).

  5. Click the Build Defaults tab.

  6. Leave the This build copies output files to a drop folder check box selected.

    Poznámka

    Your builds will fail if you clear this check box and use a build template that produces output.

  7. In the Copy build output to the following drop folder box, type the UNC file path of the folder where you want the build system to put binaries and log files.

    Důležité

    You must specify a folder that has been prepared for use as a drop folder. For more information, see Set Up Drop Folders.

  8. If more than one build controller appears in the Build controller list, click the build controller that you want the build system to use to process this build definition.

  9. Click the Trigger tab, and specify the event that should cause this build definition to be run. Select one of the following options:

    • Click Manual - Check-ins do not trigger a new build if you want this build to be run only when manually queued by a team member.

    • Click Continuous Integration - Build each check-in if you want this build to be queued every time that a change is checked in to the files that are built by this build definition.

    • Click Rolling builds - accumulate check-ins until the prior build finishes if you want this build to be queued when a change is checked in to the files that are built by this build definition but with some limits. The first limit is that no new builds are queued when a build of this build definition is already running. The second limit is optional; select the Build no more often than every n minutes check box, and type an integer value between 0 and 2147483647.

    • Click Gated Check-in - accept check-ins only if the submitted changes merge and build successfully if you want to use this build to serve as a quality gate for the files that are built by this build definition. For more information, see Define a Gated Check-In Build to Validate Changes.

    • Click Schedule - Build every week on the following days to create a scheduled build. Select the check box for each day on which you want the build to run. In the Queue the build on the default build agent at box, specify the build time.

      Poznámka

      You can optionally select the Build even if nothing has changed since the previous build check box to start a scheduled build even if no changes have been checked in since the previous build.

  10. Click the Process tab, and specify details about what functions this build performs and how it performs them:

    • To define a build quickly and easily, in the Build process file list, click Default Template. Review and modify the values of the Build process parameters as necessary. For more information such as explanations of the Build process parameters and how to use them, see Define a Build Using the Default Template.

    • If your team must use a build process that is driven by MSBuild, in the Build process file list, click Upgrade Template. Review and modify the values of the Build process parameters as necessary. For more information such as explanations of the Build process parameters and how to use them, see Define a Build Using the Upgrade Template.

    • If your team has defined a custom template that you want to use, click it in the Build process file list. Review and modify the values of the Build process parameters as necessary. For more information, see Create and Work with a Custom Build Process Template.

  11. Click the Retention Policy tab.

    Two sets of retention policies appear in the Specify how builds should be retained list and can be modified to meet your team's needs:

    • The Triggered and Manual group of policies limit what the system keeps from those builds that were queued either manually or by an automatic trigger.

    • The Private group of policies limit what the system keeps from those builds that were queued either manually from source code in a shelveset (as described in Queue a Build).

    To modify a retention policy for Stopped, Failed, Partially Succeeded, or Succeeded completed builds, perform either or both of the following steps:

    • Click the value in the Retention Policy column, and click one of the following options: Keep All, Keep Latest Only, Keep 2 Latest, Keep 5 Latest, Keep 7 Latest, Keep 10 Latest, or Specify Count to Keep.

    • Click the value in the What to Delete column, and click a value. For more information about these values, see Delete a Completed Build.

  12. Click the Workspace tab.

    The Working folders table appears. This table lists the version control folders for the team project for which you are creating the build definition and maps them to local folders on the build agent.

    The local folder on the build agent appears in the Build Agent Folder column. You can include the $(SourceDir) token to indicate that you want to download the files to the build agent's Sources subdirectory.

    To copy an existing workspace to the list of working folders, click Copy Existing Workspace to open the Select a Workspace dialog box.

  13. When you finish working on the build definition, open the File menu, and click Save <Name of Build Definition>.

    The created build definition appears in the Builds folder in Team Explorer. To view or modify the settings of the build definition, you right-click it, and then click Edit Build Definition.

See Also

Tasks

Delete a Build Definition

Concepts

Creating and Working with Build Definitions