
If you don’t know anything about the Team Foundation server, then you might be thinking that it’s some kind of tool like SVN/GIT, etc., or a source version control system. However, version control is only a part of this. The team foundation server(in short, TFS) is an excellent innovation by Microsoft integrated with Visual Studio and provides an easy/effective way to manage a software development project completely. A single tutorial won’t be enough to cover all its features. So, in this tutorial, I will explain only the TFS source control part. Also, as this tutorial is intended for developers only, I will only cover installing/configuring TFS clients. And, of course, details on how to use it.
Installing:
If you are using Visual Studio 2008, you must have Service Pack 1 installed before you can install Team Foundation client software. You can download the Team System Client for Vs 2008 from this Microsoft download link.
If you are a Visual Studio 2010 user, you won’t have to do anything. It’s already a part of Visual Studio 2010, so there is no need for any external installation. Also, for this tutorial, I have used Visual Studio 2010, and this is highly recommended.
Configuring:
To Start working with TFS, we will first have to connect to the TFS server and set up the initials. On the Visual Studio menu, you should see a menu named ‘Team,’ which will include only one option titled ‘Connect To Team Foundation Server.’
From here, you will get a ‘Connect To Team Project’ dialogue. This originally contains the listing of team projects on a selected server. As we don’t have any server configured, there will be nothing here now. Click on the ‘Servers’ button.
This should give you another new dialogue that can be used to manage TFS servers. That means you can add or remove a server here. However, I didn’t find a way to edit a server, though. (Is this a limitation that we can acknowledge? :p).
Well, now that we need a server, if you just click on the ‘Add’ button, you should get another(oh, yes, 🙂 ) new dialogue.
Here, you can provide the URL, port, extra URI path, and protocol(HTTP/HTTPS). However, instead of giving individual details, a complete URL that contains all the info will also work. This can be like “http://yourtfsserver.com:8080/extrauripath.”
After you have added the server, select it on the “Connect to Team Project” dialogue(it should be automatically selected if there is only one server). Now, select the proper ‘Project Collection'(if there is more than one) and then select your specific project.
Then, you should be prompted to select a local pc directory where you wish to save all the files. Then, it will perform a complete ‘checkout’ operation to download all the latest files from the server(nothing if a new empty project).
Browse Server Contents:
There are two windows to view the server files. First, on ‘View -> Team Explorer,’ you will see the team foundation server’s items like Work Items, Documents, Reports, Builds, and Source Control. The main concern for us at this moment is using the ‘Source Control’ part. If you click on that option, you will get to another new window, which shows you all server files inside your team foundation server project.
Adding/Deleting Files/Directories To TFS Source Control:
You should be able to see some options on the top bar of the source control explorer window. Similar options will be found if you right-click your mouse inside the area. To add one/more file(s)( or directories), just use the ‘Add Items To Folder’ option. Here, I want to add a suggestion that, although you will be able to select files from other directories as well, it will be best to first add items to your local file system (relatively) where you want them to be placed on the server. Then, add the add option on source control explorer to add them from there.
After you perform the addition, those files/directories won’t be committed to the server yet. You will then have to perform another operation named ‘Check In Pending Changes’ to add them permanently to the TFS server(it is similar to the commit option on SVN)
Similarly, you can delete files/folders from the server using the ‘delete’ option and then finally check in the pending changes. Here, just to mention, removing something using the source control explorer will not necessarily remove it from your local file system. You can do it manually.
Edit File:
To Edit a file, you should first use the option ‘Checkout for edit’ to acknowledge the server that you will edit this file. Other developers will also be notified of this, and they will see this in edit mode through the source control explorer. Also, until you check out a file for editing, files will be in ‘read-only’ mode. As a result, you won’t be able to edit it externally(However, it’s still possible to do so from within Visual Studio). So, checking out for editing is a must for binary files(like doc files, etc) at least. Also, if you edit a file offline (not connected to the TFS server), it will detect the edited files and convert them to ‘edit’ mode after you get online.(However, it doesn’t work all the time; I have a little doubt whether it needs some special user action or not. I will confirm it here asap I get some clue).
Merging And Branching:
TFS also has merging and branching facilities. If your local version doesn’t match the server version or if any conflicts occur, you can either manually merge them in the merge tool or command TFS to auto-merge (you will only get this option if TFS thinks that it can be merged automatically).
If you have to work on several files that are all related to a single feature, it’s best to create a branch of the project or code file(s) and work on them. After finishing your task, you can again use the TFS merge command with the main branch, which will automatically incorporate those changes. Finally, you will have to commit as well.
Shelve Set:
If you are an earlier SVN user, you may be new to this term. The Team Foundation server has this feature, which allows you to save your local edit as a separate item on the server. This item can be retrieved and reviewed by other developers on your team. After approval of suggestions, it can be deleted or checked into the main version control stream.
However, this is actually designed to be used with the software development life cycle through the Team Foundation Server. I will explain it more in the upcoming days in another tutorial describing maintaining the software development life cycle using TFS.
References:
I hope this TFS source control tutorial is helpful to you. I haven’t discussed a basic overview of the overall Team Foundation server architecture. If you haven’t done so, you can follow the links below to get one.
Let me know if you are having an issue with understanding any part. Happy programming 🙂
Discover more from CODESAMPLEZ.COM
Subscribe to get the latest posts sent to your email.
Very nice article.
Nice thanks. It’s been over 2 years, have you finished your “other tutorial describing maintaining software development life cycle using tfs”?
Yup, its already available here: tfs sdlc tutorial. I can understand your confusion/problem to find the other article, thanks for pointing that out. I will update the article with proper linking soon.