2017-03-15 91 views
0

我正在尋找一種方法來通過PowerShell在TFS中設置簽入策略。理想情況下,我將遍歷整個TFS項目集合/項目層次結構,並打開檢入策略所需的工作項目。我見過並嘗試過這個人的解決方案:http://www.manasbhardwaj.net/set-checkin-policies-projects-team-foundation-server-using-powershell/,但它不起作用。無法找到Microsoft.TeamFoundation.VersionControl.Controls.WorkItemPolicy,所以這種方法是徒勞的。我已經想出瞭如何遍歷層次結構,但是我找不到設置策略的魔法。任何人?PowerShell設置登記策略

TFS 2013,內部部署。 Visual Studio 2015/2017。

回答

1

Microsoft.TeamFoundation.VersionControl.Controls.dll仍附帶VS 2015/VS 2017,但它已從GAC中刪除客戶端OM DLL。

在VS 2015中,您可以在C:\program files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer中找到該DLL。

在VS 2017中,您可以在C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer找到該DLL。

+0

是的,我發現在其他地方,但我想我不清楚如何在PowerShell腳本中引用它。我正在使用[System.Reflection.Assembly] :: LoadWithPartialName(「xxxx」)來引用,但我想它不可用於加載腳本。我試過使用Add-Type -AssemblyName「xxx」,但沒有愛。 –

+1

@JimRoth使用Add-Type -Path「[程序集路徑]」 –

+0

Add-Type -AssemblyName「C:\ program files(x86)\ Microsoft Visual Studio 14.0 \ Common7 \ IDE \ CommonExtensions \ Microsoft \ TeamFoundation \ Team Explorer \ Microsoft .TeamFoundation.VersionControl.Controls.dll「 不起作用。 「給定的程序集名稱或代碼庫是無效的。」 –