【发布时间】:2017-12-06 14:13:15
【问题描述】:
我正在尝试使用 PowerShell 获取 TFS 2013 中特定解决方案/项目的最新标记代码。如果有人知道如何获取最新标签,请在此处发布。
【问题讨论】:
标签: powershell tfs
我正在尝试使用 PowerShell 获取 TFS 2013 中特定解决方案/项目的最新标记代码。如果有人知道如何获取最新标签,请在此处发布。
【问题讨论】:
标签: powershell tfs
您可以使用以下脚本获取特定项目的最新标签:
#Add Reference Assemblies to be loaded accordingly based on your VS client.
add-type -Path 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Microsoft.TeamFoundation.VersionControl.Client.dll'
add-type -Path 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Microsoft.TeamFoundation.Client.dll'
$CollectionUrl = 'http://servername:8080/tfs/DefaultCollection'
$tfs = [Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory]::GetTeamProjectCollection($CollectionUrl)
$vcs = $tfs.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer])
$labels = $vcs.QueryLabels('*','$/ProjectName',$null,$true)
$latestlabel = $labels | Select-Object -first 1
write-host "The Latest Lable Name:" $latestlabel.Name
write-host "The Latest Lable ID :" $latestlabel.LabelID
【讨论】: