If you don’t know anything about Team foundation server, then you might be thinking that, its some kind of tool like SVN/GIT etc source version control system. But, version control is only a part of this.Team foundation server(in short, TFS), is a great innovation of Microsoft, that is integrated with Visual Studio and provide a 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 be explaining the tfs source control part only. Also, as this tutorial is intended for developers only, I will only cover installing/configuring TFS client only. And of course, details on how to use it.
If you are using visual studio 2008, then you must need to 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, then you won’t have to do anything and its already a part of visual studio 2010. So, no need for any external installation. Also, For this tutorial, I have used visual studio 2010 and this is highly recommended.
To Start working with TFS, first we will have to connect to TFS server and setup the initials. On 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 an ‘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 at this moment. Click on the ‘Servers’ button.
This should give you another new dialogue which can be used to manage TFS severs. 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 as we need a server, if you just click on the ‘Add’ button, you should come up with another(oh, yes, 🙂 ) new dialogue.
here, you can provide the url, port, extra uri path,protocol(http/https). However, instead of giving individual details, if you give a complete url that contains all info, will work also. This can be like “http://yourtfsserver.com:8080/extrauripath”.
After you have added the server. select it on “Connect to Team Project” dialogue(It should be automatically selected if only one server). Now, select proper ‘Project Collection'(If more than one) and then select your specific project.
Then you should be prompt to select a local pc directory where you wish to save all the files. then, it will perform a complete ‘checkout’ operation that will download all latest files from the server(nothing if a new empty project).
Browse Server Contents:
There are two windows to get you see the server files. First, On ‘View -> Team Explorer’ you will see the team foundation server’s all items like Work Items,Documents,Reports,Builds and Source Control. The main concern for us at this moment is to use the ‘Source Control’ part. If you click on that option, you will get to another new window, which actually shows you all server files inside your team foundation server project.
Adding/Deleting Files/Directories To Source Control:
You should be able to see some options on the top bar of source control explorer window. Similar options will be found if you right click of your mouse inside the area. To add one/more file(s)( or directories), just use the ‘Add Items To Folder’ option to do so. 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 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 server yet. You will then have to perform another operation named ‘Check In Pending Changes’ to add them permanently to tfs server(its similar to the commit option on SVN)
Similarly you can delete files/folders from server using the ‘delete’ option and then finally checking in the pending changes. Here, just to mention, remove something using the source control explorer will not necessarily remove them from your local file system. You can do it manually.
To Edit a file, you should first use the option ‘Checkout for edit’ to acknowledge server that you are going to edit this file. This will be notified to other developers also and they will see this in edit mode through source control explorer. Also, until you checkout a file for edit, files will be in ‘read only’ mode. As a result, you won’t be able to edit it externally(However its still possible to do so from within visual studio). So, checking out for edit is kind of must for binary files(like doc file etc) at least. Also, if you edit a file in offline mode(not connected to tfs server), it will detect the edited files and will convert them to ‘edit’ mode after you get to online.(However, it doesn’t work all the time, I have a little doubt is need some special user action or not, I will confirm it here asap I get some clue).
Merging And Branching:
TFS has merging and branching facility as well. If your local version doesn’t fit with server version, in short, if any conflicts occurs, you can either manually merge them in merge tool or you can command tfs to do 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 and all are related to a single feature, its 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 and it will automatically incorporate those changes itself. Finally, you will have to commit as well.
If you are a earlier SVN user, then you may be new to this term. Team foundation server has this feature, which allows you to save your local edit as a separate item in server, which can be retrieved and reviewed by other developers of your team. After approval suggestions, it can be deleted or check in to the main version control stream.
However, this is actually designed to be used with software development life cycle through team foundation server. I will explain about it more on upcoming days on some other tutorial describing maintaining software development life cycle using tfs.
Hope this tfs source control tutorial is helpful to you. I haven’t discuss about any basic overview about overall team foundation server architecture. You can follow the links below to get some if you haven’t.
Let me know if you are having issue with understanding any part.Happy programming 🙂
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”?
Md Ali Ahsan Rana says
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.