Delete Command (Team Foundation Build)
You can use the delete command to delete a completed build, including some or all of the related data.
Note
This command does not delete data from the warehouse; to perform this kind of operation, use the destroy command. For more information, see Destroy Command (Team Foundation Build).
Required Permissions
To run the delete command, the account requesting the delete operation must have the Delete builds 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.
TFSBuild delete /collection:teamProjectCollectionUrl /builddefinition:definitionSpec buildnumber[buildNumber...] [/deleteOptions:deleteOptions] [/noprompt] [/silent] [/preview]
TFSBuild delete /collection:teamProjectCollectionUrl buildUri[buildUri...]
TFSBuild delete teamProjectCollectionUrl teamProject buildNumber[buildNumber...]
TFSBuild delete /collection:teamProjectCollectionUrl /dateRange:[date]~[date] /buildDefinition:definitionSpec
TFSBuild delete /collection:teamProjectCollectionUrl /dateRange:[date]~[date] teamProject
Parameters
Argument |
Description |
---|---|
teamProject |
The team project name for which this build definition exists. |
definitionSpec |
Used with /builddefinition. The build or builds that you want to delete. Wildcard characters are supported. |
buildNumber |
A space-separated list of the build or builds that you want to delete. If the build number has spaces, enclose the number in single quotation marks. Wildcard characters are supported. |
buildUri |
A space-separated list of the URIs of the builds that you want to delete. |
teamProjectCollectionUrl |
The URL of the team project collection that contains the build that you want to delete (for example, http://myserver:8080/tfs/DefaultCollection). |
deleteOptions |
The value that the user provides for the /deleteOptions option. To delete a build, you can specify one or more of the following options:
|
date |
The user provided value for the /daterange option. You can specify date ranges by using "~" as the following examples show:
|
Option |
Description |
---|---|
/noprompt |
Do not prompt when you are deleting a build. |
/silent |
Do not write output to the Command Prompt Window while deleting. Implies /noprompt. |
/builddefinition |
Specifies the build definition or definitions that you want to delete. |
/collection |
Specifies the team project collection. |
/deleteOptions |
Specifies the options for deleting a build. |
/preview |
Displays what would occur, without actually performing the delete operation. |
/daterange |
Specifies the date range of the builds that you want to delete. |
Remarks
Delete process
If a failure occurs during this process, a warning message appears. However, even if a warning appears, the deletion is considered successful.
Multiple builds being deleted
If you specify multiple builds, a failure to delete one of the builds does not stop the process. The command continues to delete 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 in the team project collection at http://myserver:8080/tfs/DefaultCollection.
> > tfsbuild.exe delete http://myserver:8080/tfs/DefaultCollection 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 in the team project collection at http://myserver:8080/tfs/DefaultCollection.
>tfsbuild.exe delete /collection: http://myserver:8080/tfs/DefaultCollection /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 in the team project collection at http://myserver:8080/tfs/DefaultCollection.
>tfsbuild.exe delete /collection:http://myserver:8080/tfs/DefaultCollection vstfs:///TestBuild/TestBuild/1 vstfs:///TestBuild/TestBuild/29