How to use the TF version control command line from VS 2003 and other environments

Buck Hodges

We’ve had a lot of customer feedback on wanting integration in VS 2003, VB6, etc.  The problem with the VS 2003 environment is that there can only be a single version of the CLR loaded into a process.  VS 2003 loads 1.1.  The TF source control integration requires that the 2.0 CLR be used.  Thus, our VS integration code won’t run in VS 2003.  With other environments that don’t load a particular CLR, there is the possibility of writing a plugin to provide TF source control integration.

You can also use Team Foundation Client (which is being renamed Team Explorer) as a stand alone interface to all of Team Foundation running side by side with VS 2003.

However, if you are writing code and you just want to check out, check in, etc. from with VS 2003, here’s a way to do it right now.

The command line works well and invokes dialogs for commands like checkin, shelve, history, resolve (for conflict resolution), workspace, etc.  These dialogs contain features you would get in the full VS 2005 source control integration (it’s a subset of what’s in the VS integration).  For example, the checkin dialog when run from the command line gives you the almost the same features as the Pending Checkins window (the shelve and unshelve buttons aren’t available in the checkin dialog, but you get pending changes, the ability to compare files, associate or resolve work items, add checkin notes, and evaluate checkin policies).

The diff command launches the diff viewer.  In beta 2, shelve has a dialog but unshelve does not (unshelve does have the dialog in the the July CTP).  Other commands like checkout (aka edit) and add don’t have any UI and just run.

You can hook up get, edit, add, delete, checkin, status, diff, workspace, etc. this way.  For some commands, like checkin, status, and shelve, you don’t need to specify an argument (drop the $(ItemPath), which represents the currently open file, and just add the command for those).  The letter in the title after the ampersand becomes the second half of the shortcut so you can run it from the keyboard (Alt T E to edit the current file as shown below)

Here’s the information to put into the External Tools dialog.  After entering the information, click the Add button.  Repeat this for each command you’d like to run.

Title:             Hat &Edit
Command:           C:Program FilesMicrosoft Visual Studio 8Common7IDEh.exe
Arguments:         edit $(ItemPath)
Initial directory: $(ItemDir)

The $(ItemPath) will cause it to check out the file that’s currently open in VS.  Be sure to check the Use Output Window checkbox so the command line output goes to the VS output window.

For commands like get, shelve, checkin, and status, you would omit $(ItemPath).

0 comments

Leave a comment

Feedback usabilla icon