Getting Started With Team Foundation Service – Part 3

Source Control

If you are reading this post, you are likely a software developer and the first thing you want to do after establishing a connection to Team Foundation Service is to set up your code in source control. In this post, I will walk you through how to get your code into source control and establish a good foundation for a branching strategy.

  • Now that we have a connection to TFS, let’s create a new project and get it into source control! From the File menu, hover over New, and then select Project…

  • It doesn’t matter what project template you choose, but let’s create a WPF application for this. When the New Project dialog appears, look through the installed project templates on the left. Under Installed, Templates, Visual C#, select Windows. In the middle pane, select WPF Application. You can leave the defaults for everything else, but be sure to check the box labeled Add to source control. Click the OK button to create the new solution.

  • The Add Solution WpfApplication1 to Source Control dialog box appears so you can choose where you want to save your application up in Team Foundation Service. Select the team project you wish to use (you likely only have one at this point).
  • Click the Make New Folder button and enter a name to represent your or your team of developers. I like to enter the name of the team that will own the software first. (In my case, this will be our community “GiveCamp” team.) We will revisit this again in an upcoming blog post about teams in Team Foundation Service.
  • Click the Make New Folder button again and enter the name of the software product or component you will be developing. (I’m not feeling very creative so I’m just going to enter “WpfApplication1”.) This is the name of our new software application and this folder will act as the parent folder for our branches.
  • Click the Make New Folder button one last time and enter “MAIN”. This folder represents the root branch of our application.
  • Leave the other fields with their default values and click the OK button to map your local copy of the new solution to its counterpart up in Team Foundation Service.

  • Now, let’s open Source Control Explorer so we can see our files from the perspective of the server. From Visual Studio’s main menu, select View, Other Windows, and then select Source Control Explorer.

  • Right-click the folder representing your team (“GiveCamp” for me) and, from the context menu that appears, select Check In Pending Changes.

  • Your cursor should be focused on the Team Explorer window which has changed to the Pending Changes view. Enter a comment for your check-in like “Initial setup of solution”.

  • Click the Check In button (just above the Comment field). Click the Yes button if you are prompted to confirm your check-in.

Congratulations! You now have code under source control in your area of the cloud. You can continue to make changes to the application in order to get more comfortable with checking out/in code.

If this is your first exposure to source control – WELCOME! Source control is an essential tool of software development – whether you are a large corporate team or a lone developer. While it is a very complex topic, I’ve provided my take on some basic vocabulary below:

  • Getting latest – Before you edit code in source control, you should probably be sure you are working with the latest version of the code. We call that “getting latest” because you are retrieving any changes to the code from the server.
  • Checking out – This marks the files so others can see you are making changes to them. It doesn’t mean they can’t make changes to the same file, but remember your edits are local only at this point and they can’t see what work you’ve done until…
  • Checking-in – This action commits your changes to the source control for server.

That’s all for now. We’ll talk about setting up a team to collaborate with next.


Posted on March 18, 2012, in TFS, Visual Studio. Bookmark the permalink. 1 Comment.

  1. Kevin Hermann

    Great stuff, and a good demonstration yesterday. I am very excited about using TFS after using Visual Source Safe for a few years. I look forward to more posts, specifically centered around setting up the workflows.


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

%d bloggers like this: