Custom build task is not deleted

不羁岁月 提交于 2019-12-24 19:06:12

问题


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:

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:


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.



来源:https://stackoverflow.com/questions/47272349/custom-build-task-is-not-deleted

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!