Bagikan melalui


Destroy Command (Team Foundation Build)

You can use the TFSBuild destroy command to permanently destroy completed builds. By destroying obsolete completed builds, you can save space in your data warehouse.

Warning

Use this command carefully because you cannot reverse its effect.

This command permanently deletes the database record for a build but not build-related artifacts, such as drops, version control labels, and test results. You can use the TFSBuild delete command to delete artifacts before you permanently destroy the build.

Required Permissions

To use the destroy command, you must have the Destroy Builds permission set to Allow. This permission is automatically given to team project collection administrators, project administrators, and builders. For more information, see Team Foundation Server Permissions.

TFSBuild destroy /collection:TeamProjectCollectionUrl /BuildDefinition:DefinitionSpec BuildNumber [BuildNumber...] [/noprompt] [/silent] [/preview] 

TFSBuild destroy /collection:TeamProjectCollectionUrl BuildUri [BuildUri...]

TFSBuild destroy TeamProjectCollectionUrl TeamProject BuildNumber [BuildNumber...]

TFSBuild destroy /collection:TeamProjectCollectionUrl /DateRange: [Date]~[Date] /BuildDefinition:DefinitionSpec

TFSBuild destroy /collection:TeamProjectCollectionUrl BuildUri [BuildUri...]

Parameters

Argument

Description

TeamProjectCollectionUrl

The URL of the team project collection that contains the build that you want to destroy (for example, http://myserver:8080/tfs/DefaultCollection).

DefinitionSpec

Used with /BuildDefinition. The build definitions that you want to destroy. You can use wildcard characters.

BuildNumber

A space-separated list of the build or builds that you want to destroy. If the build number has spaces, enclose the number in single quotation marks. You can use wildcard characters.

BuildUri

A space-separated list of the URIs of the builds that you want to destroy.

TeamProject

The team project name for which this build definition exists.

Date

Used for the /daterange option. A date in any format that the .NET Framework can parse. You can specify date ranges by using "~" as the following examples show:

  • ~1/1/2010 – all builds that were created before 1/1/2010

  • 1/1/2010~ – all builds that were created after 1/1/2010

  • 1/1/2009~12/31/2009 – all builds that were created between 1/1/2009 and 12/31/2009

Option

Description

/collection

Specifies the team project collection.

/BuildDefinition

Specifies the build definition or definitions that you want to delete.

/preview

Displays in the Command Prompt window the builds that would be destroyed. When you specify this option, the builds are not actually destroyed.

/noprompt

Specifies not to prompt you when you are deleting a build.

/silent

Specifies not to write output to the Command Prompt Window while builds are deleted. Implies /noprompt.

Remarks

If you try to destroy a build without the appropriate permission, a dialog box informs you of that fact.

Example

The following example permanently destroys builds that are older than November 20, 2010, and that are based on the "Nightly Build" build definition in the "New Works" team project.

>tfsbuild.exe destroy /collection: http://myserver:8080/tfs/DefaultCollection /builddefinition:"New Works\Nightly Build" /daterange:~2010-11-20

See Also

Tasks

Delete a Completed Build

Create a Basic Build Definition

Concepts

Run and Monitor Builds

Define Your Build Process

Other Resources

Team Foundation Build Commands