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

Microsoft Visual Studio 2008 - first steps

Some time ago, I've noticed that many novice C++ programmers still use obsolete Dev-C++ IDE, which is in my opinion quite uncomfortable and buggy. I wonder why they won't try something else, e.g. Code::Blocks or... Microsoft Visual Studio. I think it's one of the best IDEs for Windows. At first glance, one might feel a bit overwhelmed with the huge number of features it offers. The truth is that when one learns the basics, VS appears to be very easy and convenient in use. To prove it, I've written the short step-by-step tutorial showing how to compile the simpliest "Hello World" program with Visual Studio 2008:

  1. Choose File --> New --> Project...
  2. Select  Win32 Console Application template and click OK.
  3. Click Next.
  4. Deselect Precompiled header option and click Finish.
  5. Go to Solution Explorer. If it isn't shown by default, you can make it visible by choosing View --> Solution Explorer menu option. Then delete the following files: stdafx.h, targetver.h, stdafx.cpp and ReadMe.txt .
  6. There should be only one .cpp file left. Its default content looks like this:

    We will make it simplier by removing fragments marked red:

    // HelloWorld.cpp : Defines the entry point for the console application.
    #include "stdafx.h"
    int _tmain(int argc, _TCHAR* argv[])
        return 0;

    So the modified code is:

    int main()
        return 0;
  7. Now you can type some simple C/C++ code and press F5 to compile and run the application.
As you can see, Visual Studio is not so scary and I'm sure that every programmer (even beginner) can successfully use it. So why won't you have a try?