This project is read-only.

How to Automate Common Version Control Tasks

- J.D. Meier, Jason Taylor, Alex Mackman, Prashant Bansode

To automate common version-control tasks, use the Team Foundation command-line tool (tf.exe). With this tool, you can do everything that you can do with Source Control Explorer, including source control operations (add, check-in, checkout, get, lock, label, and more), branching, shelving, workspace manipulation, and general administration tasks.

The main reasons for using the command-line tool include automating repetitive operations and scheduling operations to run at specific times or on specific events by using the Microsoft Windows® Task Scheduler. The following commands are also only available from the command line:
  • Deleting another user’s workspace
  • Undoing another user’s checkout
  • Unlocking another user’s lock
  • Defining label scope
  • Performing a baseless merge

To ensure that the appropriate path and other environment variables are set up, run the command-line tool from the Visual Studio 2005 Command Prompt window, or run the Vsvars32 batch file, which is normally located in DriveLetter:\Program Files\Microsoft Visual Studio 8\Common7\Tools.

Tf.exe is installed as part of the TFS client and is located by default in the following folder:
C:\Program Files\Microsoft Visual Studio 8\Common 7\IDE.

To run the command-line tool, you must specify a server name with the /s switch. The following command shows how to view the files in source control on the server named YourTFSServer:

tf.exe dir /s:YourTFSServer

Additional Resources

Last edited Jul 31, 2007 at 2:16 PM by prashantbansode, version 9


No comments yet.