0

在 TFS 2013 中,构建会像这样在全局列表中输入:

(build definition)/(version)

而在 TFS 2010 之前,它们是这样的:

(version)

这让我们很头疼,我们发现解决这个问题的唯一方法是在每次构建后手动编辑每个构建列表项。

4

1 回答 1

0

我认为这是设计使然。作为一种解决方法,您可以编写一个脚本来为您更新它。例如在 PowerShell 中:

$filePath = "$env:TEMP\gl.xml"
$collectionUrl = "http://<server name>:8080/tfs/<collection name>"
$vsPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio 12.0\Common7\IDE"

& (Join-Path $vsPath -ChildPath "witadmin.exe") exportgloballist /collection:$collectionUrl /f:$filePath

$gl = [xml](Get-content $filePath)

foreach ($list in $gl.GLOBALLISTS.GLOBALLIST) 
{
    if($list.name.StartsWith("Builds"))
    {
        "Found " + $list.name
        foreach($item in $list.LISTITEM)
        {
            if($item.value.Contains("/"))
            {
                $item.value = $item.value.Substring($item.value.IndexOf("/") + 1)
            }
        }   
    }
}

$gl.Save($filePath)

& (Join-Path $vsPath -ChildPath "witadmin.exe") importgloballist /collection:$collectionUrl /f:$filePath 
于 2015-06-04T02:59:04.647 回答