Delete Command (Team Foundation Build)

The delete command deletes a specified completed build. All data related to the build is deleted from the build agent and version control, and the drop location is cleared. Additionally, the build is no longer listed in Builds Explorer.

Required Permissions

To run the delete command, the account requesting the delete operation must have the Administer a build permission set to Allow. If the build that is deleted has test results associated with it, the account must have the Publish test results permission set to Allow. Additionally, the application-tier service account and the Team Foundation Build service account must have read/write permissions to the build drop location. For more information, see Team Foundation Server Permissions.

Note

Even if you are logged on with administrative credentials, you must open an elevated Command Prompt to perform this function on a server that is running Windows Server 2008. To open an elevated Command Prompt, click Start, right-click Command Prompt, and click Run as Administrator. For more information, see the Microsoft Web site.

TFSBuild delete [/noprompt] [/silent] /server:teamFoundationServer /builddefinition:definitionSpec buildNumbers…

TFSBuild delete [/noprompt] [/silent] /server:teamFoundationServer buildUris…

TFSBuild delete [/noprompt] [/silent] teamFoundationServer teamProject buildNumbers…

Parameters

Argument

Description

teamfoundationserver

The Team Foundation server URL that is used for the builds.

teamProject

The team project name for which this build definition exists.

definitionSpec

Used with /builddefinition. The build or builds that are to be deleted. Wild-card characters are supported.

BuildNumbers

A space separated list of the build or builds that are to be deleted. If the build number has spaces, put single quotes around this number. Wild-card characters are supported.

buildUris

A space-separated list of the list of build URIs of the builds that are to be deleted.

For example, tfsbuild delete uri1 uri2 uri3 /s:MyServer.

Option

Description

/noprompt

Optional. Do not prompt when deleting a build.

/silent

Optional. Do not write output to the command-prompt window while deleting. Implies /noprompt.

/server

The Team Foundation server used for the build or builds to be deleted.

/builddefinition

Specifies the build definition or definitions to be deleted.

Remarks

Delete process

When you delete a build number, follow these steps:

  • Verify that the build number is valid and the build is not in progress.

  • Delete the contents of the build store and drop site if the requestor has Administer Build permission.

  • Clear the drop location of the binaries from this build. If a failure occurs during this process, you are prompted with a warning message. However, even with the warning, the deletion is considered successful.

    Note

    No data is deleted from the warehouse.

Multiple builds being deleted

If you specify multiple builds, a failure in deleting one of the builds does not stop the process. The command continues deleting the other builds after providing a build-deletion-failure error message.

Event log

Build deletions are logged in the event log. The log will have information about who deleted the build, the time the build was deleted, and the build number.

Example

The following example deletes two builds defined by build numbers "TestBuild1 1_20070510.1" and "TestBuild 1_20070510.2" from the AdventureWorks team project on server01.

> > tfsbuild.exe delete http://server01:8080 Adventureworks "TestBuild1 1_20070510.1" "TestBuild 1_20070510.2"

The following example deletes two specific builds where the definitionSpec is "\Adventureworks\Definition1" from the AdventureWorks team project on server01.

>tfsbuild.exe delete /server:http://server01:8080 /builddefinition:"\Adventureworks\Definition 1" "Definition 1_20070510.1" "Definition 1_20070510.2"

The following example deletes two builds defined by the build URIs "vstfs:///TestBuild/TestBuild/1" and "vstfs:///TestBuild/TestBuild/2" from the AdventureWorks team project on server01.

>tfsbuild.exe delete /server:http://server01:8080 vstfs:///TestBuild/TestBuild/1 vstfs:///TestBuild/TestBuild/29

See Also

Tasks

How to: Delete a Completed Build (Command-Line)

How to: Create a Build Definition

Other Resources

Team Foundation Build Commands

Running Builds in Team Foundation Build

Working with Build Definitions in Team Foundation Build