Tuesday, January 29, 2013

TFS tutorials for beginners




What is TFS?
It is a team foundation server. It is a central repository  or storage with version control. Initially Microsoft has VSS(Visual source safe ) for version control. TFS is new extended version of VSS with lot of new features and capabilities.
Three major features
  •  Source Control
  •  Builds
  • Work Items

We will discuss all of above shortly.    Lets start with connect to TFS server with images.


In order to connect TFS from visual studio. Click on Team menu and click on "Connect to Team Foundation Server.."  You can do it same from Start page also.



It will open following dialog box. Click on "Servers.." button.



You can add your TFS server here by clicking on Add button.



Add TFS server Name. If you have additional path after server then you can add it in Path text box. It will show final TFS url in preview section.



 Once you add url, you will get following like dialog box window, where you can find all team projects. you can select your project by check it and click on "Connect".


After connect it opens Team explorer window in visual studio. Which has sections like  Documents, Reports, Work Items, Builds, Source Control.


Source control opens following like  explorer in visual studio. Select your project folder. that project folder should be mapped with your local machines folder. If it is not mapped then it shows at Local Path section as "Not mapped". Click on "Not mapped" link and you can map TFS folder with local machine folder.


It opens following like window. you can insert your local machine path to  map folder. once you click on "Map" button. It downloads all source code files from TFS server to your local machine mapped folder.


It will show following like explorer after mapping. you can find your .sln (solution) file and directly open from there.


You can see different  symbol for particular files. 
  "+" is for newly added file
            "right mark" for checked out file.
"lock" for checked in file


Add new file

You can add new file from project solution and it will automatically added to TFS and shows as "+" symbol. you also can add existing file to TFS from Source Control explorer by right click and "Add items to folder".


Check out


If you want to change already existing file then you need to checked out it first. It will lock files for other users and available for you in edit mode. checked out file shows in "right mark" symbol.


Check in

After finished working on file you can commit your changes back to TFS by check in them.  you can check single file by right click on that file from solution explorer in visual studio and click on "Check in".


You can add your comments like what change you have done etc. on comments box. you can see all related files only has checked for check in following image.



You can also check in multiple file by opening "View Pending changes" window in visual studio. you can select multiple files from there by checked them and check in together. you can also attach "Work Item" for each check in. Check in will create new Change set in TFS. it will be new unique changes set number assigned for each change set. 


Added more info here (http://atulkumarpatelsblog.blogspot.com/2014/01/tfs-with-vs-2013-tutorial.html)