代码之家  ›  专栏  ›  技术社区  ›  InteXX

未删除自定义生成任务

  •  0
  • InteXX  · 技术社区  · 7 年前

    我正在尝试使用删除生成任务 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 回复  |  直到 7 年前
        1
  •  1
  •   InteXX    7 年前

    我可以通过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删除。