开发者

Check-out/in files on TFS via PowerShell

开发者 https://www.devze.com 2023-01-31 15:46 出处:网络
I\'d like to use PowerShell to automate check-out and check-in of edited .csproj files to TFS.I only need to change single files to pending and check those i开发者_JS百科n.

I'd like to use PowerShell to automate check-out and check-in of edited .csproj files to TFS. I only need to change single files to pending and check those i开发者_JS百科n.

Does anyone know how to do this?


I had the same pain you are having, and finally got to the right way of doing so. Here you go.

#Load the TFS powershell
Add-PSSnapin Microsoft.TeamFoundation.PowerShell
# the filePath should be in the format like C:\MyFodler\MyFile.txt
Add-TfsPendingChange -Edit -Item $filepath -Verbose -ErrorAction SilentlyContinue -wa 0
# Check in the file after changes.
New-TfsChangeset -Item $filepath -Verbose -Comment "Comment Here" -Override true


You can checkin with the New-TfsChangeSet cmdlet and checkout with the Add-TfsPendingChange -Edit cmdlet.

To get the cmdlets you have to have the Microsoft Team Foundation Server 2010 Power Tools installed.

0

精彩评论

暂无评论...
验证码 换一张
取 消