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.


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...]





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


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


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.


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


The team project name for which this build definition exists.


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




Specifies the team project collection.


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


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


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


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


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


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


Delete a Completed Build

Create a Basic Build Definition


Run and Monitor Builds

Define Your Build Process

Other Resources

Team Foundation Build Commands