What is TFS?
According to Wikipedia Team Foundation Server (commonly abbreviated to TFS) is a Microsoft product that provides source code management (either via Team Foundation Version Control or Git), reporting, requirements management, project management (for both agile software development and waterfall teams), automated builds, lab management, testing and release management capabilities.
It covers the entire application lifecycle. TFS can be used as a back-end to numerous integrated development environments (IDEs) but is tailored for Microsoft Visual Studio and Eclipse on all platforms.
Contents:
- TFS Requirement
- TFS Installation
- TFS Project Collection
- TFS Team Project
- Manage Source Control
- Configure Workspace
- TFS Settings
- Compare
- Branching
- Merging
TFS Requirement:
TFS installation is supported on a Microsoft Windows server/client OS. Before installation let’s have a review the System requirements for Team Foundation Server
Operation System
- Server OS
a. 64-bit versions of Windows Server 2012 R2 (Essentials, Standard, Datacenter)
b. 64-bit versions of Windows Server 2012
c. 64-bit versions of Windows Server 2008 R2 (Standard, Enterprise, Datacenter)
- Client OS
a. Windows 10
b. Windows 8.1 (Basic, Professional, Enterprise)
c. Windows 8
d. Windows 7 (Home Premium, Professional, Enterprise, Ultimate)
SQL Server
- SQL Server 2014 ¹ (Express, Standard, Enterprise)
- SQL Server 2012
Get a full review here.
TFS Installation:
Microsoft has published a “TFS Install and Administration Guide” in CHM form for download. Here you can go through by clicking the link & get it – TFS Install and Administration Guides.
I am using Windows 10 with SQL server 2014 as installation PC Let’s get into topic step by step.
FIG: 1 Let’s open the tfs server setup file.
FIG: 2 In this step a popup with setup screen will appear, accept the term and click “Install Now”.
FIG: 3 As you can see Installation is in progress.
In our next step we have to choose installation wizard,
- Basic wizard
a. Install the essential service along with SQL express installation.
- Advance wizard
a. Install all installation options.
FIG: 4 we will install using Advance wizard. Click “Start Wizard”.
FIG: 5 Advance wizard will popup. Choose “Next”.
FIG: 6 in this step we need to specify a database server, we can also use an existing empty database by specifying a database name. Choose “Next”.
FIG: 7 Here we need to provide a service account as primary account for TFS. Choose an option. In my case I have kept as default(NT AUTHORITY\LocalService) which will authorize on behalf of my account as it does not have a password. Choose “Next”.
FIG: 8 here in “Application Tire” we will configure directory & port for TFS web service. Choose “Next”.
FIG: 9 Locate a folder path for cache TFS resource which will access frequently to increase communication performance. Choose “Next”.
FIG: 10 Tick check box if you want to install a default collection(recommended) in your TFS Server. Choose “Next”.
Overview on creating new collection from here.
FIG: 11 Let’s get a review of our Installing Component. Choose “Next”.
FIG: 12 In this step our system will get validation & need to get passed to conduct installation. Choose “Next”.
FIG: 13 After passing readiness check, configuration process starts. Success message will display after completing all processes. Choose “Next”.
FIG: 14 This is the final step. Review the result here & go to the link to get enabled TFS web services. Choose “Close”.
FIG: 15 Go to > All Apps > Microsoft Team Foundation Server
FIG: 16 TFS Administration Console will run for managing the entire application life-cycle.
TFS Project Collection
Team project collection is a group of projects to manage multiple projects from a single location. Let’s start with TFS Administration Console.
FIG: 17 In Team Project Collections, choose Create Collection.
FIG: 18 The Create Team Project Collection wizard opens.
FIG: 19 In Name, specify a name for your collection. Under Description, you can optionally specify a brief description of your collection and its purpose. Choose Next.
FIG: 20 In SQL Server Instance, specify local/remote server name that hosts the database for the collection. Check first option for creating a new database for the collection, if you have existing empty database that was created before you can specify that by checking second option. Choose Next.
FIG: 21 in this step review the settings. Click Verify.
FIG: 22 In this step show verified status whether the TFS collection is ready to create or not. Click Create.
FIG: 23 the creation process starts.
FIG: 24 after completing all required process successfully the wizard finishes, Choose Close.
FIG: 25 As you can see, finally the collection is listed in the console window.
TFS Team Project
Let’s open Visual Studio 2013 to connect TFS server. From Visual Studio menu bar Choose [TEAM > Connect to Team Foundation Server] to connect TFS server.
FIG: 26
FIG: 27 In Name/URL type Local/Remote URL of TFS server. The default Port is 8080. In this case I have used local PC Name. Click .
FIG: 28 Team Project Collection will appear. Choose desired collection & Click Connect.
FIG: 29 after connecting TFS click on Source Control Explorer from Team Explorer to view the TFS Project Collection. From Visual Studio menu bar Choose [File> New > Team Project].
FIG: 30 specify Name & Description for new TFS Project. Choose Next.
FIG: 31 choose a project template to manage Team project. Choose Next.
FIG: 32 specify a version control setting. Choose Next.
FIG: 33 confirm setting. Click Finish.
FIG: 34 As you can see finishing status will appear after creating TFS project. Click Close.
Configure Workspace
Workspace is a local copy where we develop & test code. We can manage your workspaces from the Team Explorer. A default workspace created automatically, we can maintain multiple workspace.
FIG: 35 to modify Click Workspace.
FIG: 36 to modify existing workspace, Click Edit.
FIG: 37 Edit workspace window will appear, Click Advanced.
FIG: 38 edit workspace window will appear with advanced option, here we can specify workspace whether its location is Local or Server. Click Ok.
FIG: 39 Browse source control folder path for working items. Click Ok.
FIG: 40 Browse local folder path for working items. Click Ok.
FIG: 41 yes/no prompt will appear with instruction of workspace modification. Choose Yes.
Manage Source Control
TFS source control is a software configuration management that manage project folder & files of large scale of development component.
To Add item Go to > Team Explorer > Source Control
FIG: 42 add folder structure/file in this step. File/folder will add with a plus icon that indicates item has added to source control. After check-in item the icon will change.
FIG: 43 right click on project collection choose check in pending changes to upload the added file to server.
FIG: 44 Pending changes will included in team explorer, add description in comment field while check in. Click Check In.
FIG: 45 right click on main branch choose Add Items to Folder.
FIG: 46 browse desired local file to add to source control. Choose Finish.
FIG: 47 Double click on project solution that we have added to source control. A configuration warning will appear that ask to bind the solution to source control. Click Yes.
FIG: 48 Select the project solution then click Bind.
FIG: 49 as you can see an extra file (.vssscc extension) is added to source control with bind information properties.
FIG: 50 let’s update the pending changes to server. Click Check In.
FIG: 51 as you can see the files are successfully checked in to the server.
FIG: 52 build/rebuild the solution.
TFS Settings
Workspace setting:
FIG: 53 Go to [Team Explorer > Setting]
FIG: 54 Go to [Team Project Collection > Source Control]
FIG: 55 Go to tab [Workspace Setting] choose a default workspace type &
Click Ok.
Two types of workspace. As you can see from below image,
- Local workspace and
- Server workspace
With local workspace we can work offline to perform source control operations without going TFS server (Online). Working offline has no option of checkout locks.
The other hand while we are using server workspace there is a checkout lock which prevent working on single file by multiple users at the same time.
Check-in Policy
In TFS we can add check in policy, while user is going to check in pending changes.
By default, the check-in policy types:
- Builds: Requires last successful before a check-in.
- Changeset comment policy: Requires comment before check-in.
- Testing Policy: Requires tests before check-in.
- Work Items: Requires work items to be associated with the check-in.
FIG: 56 Select [Team Explorer > Setting] then Go to [Team Project > Source Control] source control setting window will popup.
FIG: 57 As you can see from the below image in Check out Setting tab enabling multiple check-out checkbox is not selected to prevent working on single files by multiple users at the same time. The other option will ensure that latest file is going to checkout and get updated.
FIG: 58 In the Check in-policy tab we have choose changeset comment policy to ensure that a comment must be provided while the file is going to check-in by user.
Compare
TFS has the facility to compare two files/ single file by changeset to see their differences.
FIG: 59 Go to [Solution Explorer > Compare] like below image.
FIG: 60 select a type Click Ok.
FIG: 61 in this window choose find option to compare between changeset.
FIG: 62 as you can see from below image, the changes of same file with different changeset.
Branching & Merging
TFS has great facility of branching & merging. In TFS we can create/convert a folder to Branch or Branch to folder.
Branching:
FIG: 63 in TFS we can convert a folder to branch or create a new branch. Go to [Source Control Explorer > Branch and Merging > Convert to Branch] like below image.
The folder will convert to a branch as well as TFS change the icon at the same time.
FIG: 64 from our converted folder we may now create a new branch by choosing the option “Branch”. In source control right click on converted folder then choose Branch and Merging > Branch.
FIG: 65 type a branch name with specifying description in description field and click Branch.
FIG: 66 yes/no prompt will appear, Click Yes to perform the operation.
FIG: 67 as you can see a new branch is created with our specified name “DEVELOPMENT”. Perform “Get Latest version” action to update the local files downloading from server.
Merging
Merging branch is another TFS great option to combine the changes between two branches. In this option we must require to resolve the conflicted file.
FIG: 68 right click the updated folder choose Branching and Merging select Marge.
FIG: 69 a wizard will appear with source & target branch path. Choose Next.
FIG: 70 choose a type then click next.
FIG: 71 TFS will do a merge operation between branches with pending changes.
FIG: 72 all changed files will included in pending list. Perform a check-in operation to update the TFS server with changed file. Click Check in.
FIG: 73 Finally Let’s build and run the application.
Reference: https://msdn.microsoft.com
Hope this will help.