Using Version Control in TFS 2012 – Part 1

Today I will focus the feature the version control stuff in TFS 2012, Whether you are building software at a large company or with a few friends in your garage, on a good day you are able to focus all your energy on researching, designing, coding, testing, and building your app. You probably give little thought to your version control system. Team Foundation version control is designed to simply and quietly as possible do just what you need it to do, which in most cases is to take good care of your code.

Let’s go through setup a Dev machine and the using the super duper version control shipped with TFS 2012 🙂

Before we start working in version control, we must:

  • Install Team Foundation Server. How?
  • Install Visual Studio on your dev box. How?
  • Create a team project (if you don’t already have one). How?

Now lets create a workspace,  below is a quick and simple steps to create a new workspace:

  1. In Windows, create the folder that will contain your code (including the solution, code projects, and the source code files). For example, this would be a good location for your folder: c:\code\SiteApp\.A great local root path for a workspace
  2. In Visual Studio, in Team Explorer:
    1. If you are not already connected to the team project that you want to work in, then connect to the team project.
    2. Choose Home icon Home, and then choose Source Control Explorer.Team Explorer Home page
  3. In Source Control Explorer, navigate to your team project. Choose Not mapped.Portal team project not yet mapped in a workspace
  4. Use the Map dialog box to map the root folder of your team project to the appropriate local folder. For example, you could map $/SiteApp to c:\code\siteapp.Map the team project root folder
  5. The system prompts you to download the files in the folder you just mapped.Download the files in the folder you just mappedChoose Yes.

After the files are downloaded, you are ready go get busy coding, unless you are beginning work in a new team project. In this case, before you get started, read on for a simple tip about folder structure.

Now we are ready to develop some code;

if you are starting to work in a new team project, then take this simple step when you set up your version control folder structure, and you’ll be ready when your team grows large enough for you to need branches to manage your work.

Put all your code in a parent called Main (for example: $/SiteApp/Main/).

To develop your code in the “Main” parent folder

  1. On the menu bar choose View, Other Windows, Source Control Explorer.
  2. In Source Control Explorer, select your team project in the left pane.
  3. On the menu bar choose File, Source Control, New Folder.Create the "Main" folder at the team project rootType Main and choose the Enter key.
  4. Open the shortcut menu of the Main folder and choose Check in.Check in the addition of the Main folder
  5. The Check-in Confirmation dialog box appears.Check-in Confirmation
  6. Select Don’t prompt again and choose Yes.
  7. Your changeset is checked in.Main folder checked in
  8. Get busy building your app. Make sure to put your code (including solutions, code projects, source files) in the Main folder that you just created.

Now that your workspace is set up, you are almost ready to begin developing code and writing tests!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s