Search code examples
tfstfsbuild

PowerShell to set Check-in Policy


I'm looking for a way to set the check-in policy in TFS via PowerShell. Ideally, I'd traverse the entire TFS project collection/project hierarchy, and turn on the Work Item required for check-in policy. I've seen and tried this guy's solution: http://www.manasbhardwaj.net/set-checkin-policies-projects-team-foundation-server-using-powershell/, but it's not working. Microsoft.TeamFoundation.VersionControl.Controls.WorkItemPolicy can't be found, so this approach is for naught. I've already figured out how to traverse the hierarchy, but I can't find the magic to set the policy. Anyone?

TFS 2013, on-premise. Visual Studio 2015/2017.


Solution

  • Microsoft.TeamFoundation.VersionControl.Controls.dll still ships with VS 2015/VS 2017, but it has been removed the client OM DLLs from the GAC.

    In VS 2015, you can find the DLL in C:\program files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer.

    In VS 2017, you can find the DLL in C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer.