Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check-out/in files on TFS via PowerShell

Tags:

powershell

tfs

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 in.

Does anyone know how to do this?

like image 451
romeozor Avatar asked Dec 17 '10 13:12

romeozor


1 Answers

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
like image 101
Ahmed IG Avatar answered Sep 19 '22 17:09

Ahmed IG