How to use TFS 2010 without launching VS 2010

Visual Studio 2010 is a very demanding IDE, as far as hardware requirements are concerned. Due to that fact, its usability on low-end machines (e.g. netbooks) is seriously limited. However, sometimes we might need to use such kind of "weakly equipped" computer to work on some project which is developed with Visual Studio 2010 and Team Foundation Server 2010. In this post I will show you how to do the following activities without the need of launching the whole Visual Studio IDE:

  1. Download latest versions of project files from the TFS
  2. Edit one of the files using an editor with syntax highliting
  3. Upload modified file to the TFS

To do this, in fact we need to perform the following steps:

  1. Create a new workspace
  2. Get the latest versions of project files
  3. Check Out a file
  4. Modify a file
  5. Check In the modified file

We won't launch Visual Studio, but it has to be installed on our machine. Further description is based on the following configuration:

TFS address: http://tfs-server:8080/tfs
Project Collection name: DefaultCollection
Team Project name: TeamProject1
Source Control project directory: $/TeamProject1

So let's begin. We will use tf command-line utility, which was installed along with VS IDE.  First, we have to open Visual Studio Command Prompt, which can be found in Start Menu.

Then, we create a new folder and change current dir to that folder:

Now, we create a new TFS workspace and name it TeamProject1Workspace:

tf workspace /new ^
  /s:http://tfs-server:8080/tfs/DefaultCollection/ TeamProject1Workspace

It might be necessary to enter our TFS credentials:

Next, we can verify displayed settings and click OK:

Finally, we are able to get latest versions of TeamProject1 files which are stored in Source Control:

tf get TeamProject1 /recursive

After downloading, all files have "read only" attribute set, because they shouldn't be modified before they're checked out. Now we may enter the directory which contains file we want to edit:

We perform Check Out:

tf checkout Program.cs

Now we can open and modify this file, for example using the free and lightweight Notepad++ text editor:

After making some modifications, we save changes and close the editor. Now, we perform Check In:

tf checkin Program.cs

And that's it! We're done :)

If we would like to work on the same team project in future, we won't need to create new TFS workspace. We can just use tha one that was created before. However, before starting our work I recommend downloading latest versions of files with tf get some_path /recursive command.

On the other hand, if we're not going to work on this project (using the same computer) any more, we are free to delete the TFS workspace and remove the working directory along with it's content:

tf workspace /delete TeamProject1Workspace