26.04.2015 Views

Team Development with Visual Studio Team Foundation Server

Team Development with Visual Studio Team Foundation Server

Team Development with Visual Studio Team Foundation Server

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

How to Automate Common Version-Control Tasks<br />

To automate common version-control tasks, use the <strong>Team</strong> <strong>Foundation</strong> command-line tool<br />

(tf.exe). With this tool, you can do everything that you can do <strong>with</strong> Source Control<br />

Explorer, including source control operations (add, check-in, checkout, get, lock, label,<br />

and more), branching, shelving, workspace manipulation, and general administration<br />

tasks.<br />

The main reasons for using the command-line tool include automating repetitive<br />

operations and scheduling operations to run at specific times or on specific events by<br />

using the Microsoft Windows® Task Scheduler. The following commands are also only<br />

available from the command line:<br />

• Deleting another user’s workspace<br />

• Undoing another user’s checkout<br />

• Unlocking another user’s lock<br />

• Defining label scope<br />

• Performing a baseless merge<br />

To ensure that the appropriate path and other environment variables are set up, run the<br />

command-line tool from the <strong>Visual</strong> <strong>Studio</strong> 2005 Command Prompt window, or run the<br />

Vsvars32 batch file, which is normally located in DriveLetter:\Program Files\Microsoft<br />

<strong>Visual</strong> <strong>Studio</strong> 8\Common7\Tools.<br />

Tf.exe is installed as part of the TFS client and is located by default in the following<br />

folder:<br />

C:\Program Files\Microsoft <strong>Visual</strong> <strong>Studio</strong> 8\Common 7\IDE.<br />

To run the command-line tool, you must specify a server name <strong>with</strong> the /s switch. The<br />

following command shows how to view the files in source control on the server named<br />

YourTFS<strong>Server</strong>:<br />

tf.exe dir /s:YourTFS<strong>Server</strong><br />

Additional Resources<br />

• For more information, see “Walkthrough: Working <strong>with</strong> <strong>Team</strong> <strong>Foundation</strong> Source<br />

Control from Command Line” on the MSDN Web site at<br />

http://msdn2.microsoft.com/en-us/library/zthc5x3f(VS.80).aspx<br />

• For more information, see “MSDN <strong>Team</strong> <strong>Foundation</strong> Source Control Command-Line<br />

Reference” at http://msdn2.microsoft.com/en-us/library/cc31bk2e(VS.80).aspx<br />

How to Work Offline<br />

Offline working is not supported natively by TFS Version Control.<br />

To work offline, you need to use the following strict workflow:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!