自定义生成任务未删除

时间:2017-11-13 19:47:00

标签: tfs command-line-interface tfsbuild

我正在尝试使用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

我现在有任务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!

但即使在Ctrl+F5刷新后,该任务仍显示在TFS中:

enter image description here

再次运行delete命令会显示相同的内容。成功。不是“找不到”,或者是某种类似的东西。

如何摆脱这个讨厌的虫子?

1 个答案:

答案 0 :(得分:1)

我能够通过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

根据Jesse Houwing的建议,我的理论是因为它首先是使用API​​创建的(我在上面评论中的回忆是不正确的),所以它也必须用API删除。 / p>