Custom build task is not deleted

2019-08-24 00:41发布

I'm trying to delete a Build Task using tfx-cli.

C:\Users\Work>tfx build tasks list
TFS Cross Platform Command Line Interface v0.4.11
Copyright Microsoft Corporation

id            : 122d5ad0-61a1-11e6-b9c1-5b12bd371fa9
name          : VersionAssembly
friendly name : Version Assembly
visibility    : Build
description   : Update the assembly version number to match the build number
version       : 1.0.9

I now have the Task ID.

C:\Users\Work>tfx build tasks delete --task-id 122d5ad0-61a1-11e6-b9c1-5b12bd371fa9
TFS Cross Platform Command Line Interface v0.4.11
Copyright Microsoft Corporation

Task 122d5ad0-61a1-11e6-b9c1-5b12bd371fa9 deleted successfully!

But even after a Ctrl+F5 Refresh, the task still shows up in TFS:

enter image description here

Running the delete command again shows the same thing. Success. Not "Can't be found," or some such thing.

How to get rid of this pesky bugger?

1条回答
贪生不怕死
2楼-- · 2019-08-24 01:41

I was able to delete the Task via the REST API:

$Credential = Get-Credential
$Headers = @{ "Accept" = "application/json; api-version=2.0"; "X-TFS-FedAuthRedirect" = "Suppress" }
$Uri = "http://hostname:8080/tfs/_apis/distributedtask/tasks/122d5ad0-61a1-11e6-b9c1-5b12bd371fa9"

Invoke-RestMethod -Credential $Credential -Headers $Headers -Uri $Uri -Method Delete

Following on Jesse Houwing's suggestion, my theory is that because it was created with the API in the first place (my recollection in my comment above is incorrect), it also had to be deleted with the API.

查看更多
登录 后发表回答