2017-07-03 7 views

答えて

1

あなたは、特定のプロジェクトのために、最新のラベルを取得するためのスクリプトの下に使用することができます。

#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 
+0

こんにちは@アンディ-MSFTを::私は前にもコマンドを言及しようとしたが、それは私にブランク値を与えています。私がここで何かが不足しているかどうかを確認して助けてください。(私が修正した行だけを述べました) - $ CollectionUrl = 'http:// servername:8080/tfs' $ tfs = [Microsoft.TeamFoundation.Client。 TfsTeamProjectCollectionFactory] ​​:: GetTeamProjectCollection($ CollectionUrl) $ vcs = $ tfs.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer]) $ labels = $ vcs.QueryLabels( '*'、 '$/project path/project .sln '、$ null、$ true) $ latestlabel = $ labels | Select-Object-first 1 –

+0

@PratikBompilwar '$/ProjectName'を実際のプロジェクト名に変更してください。ただし、 '$/project path/project.sln'は変更しないでください。例:プロジェクト名が "Test"それは$ /テストとして –

+0

ありがとう、@アンディMSFT。それは動作します。ラベル名にフィルタを使用できるかどうかはわかりますか? "test ***。***。*"から始まるラベルを検索したいとしましょう。そのようなものを含む(テスト)ものを使用できますか? –

関連する問題