Working With Project Collection In TFS

In this article, we will see what a collection is and how to create a new collection.

In this article, we will see what is Project Collection in TFS.

But before we go deep into what is a collection in TFS, we will get a basic idea of what a TFS is and what it is used for.

What is TFS?

According to Wikipedia ,TFS is a product that was initially released by Microsoft in the year 2005. It basically covers the entire application development lifecycle and now even have capabilities of DevOps.It provides features like source code management, project management, automated build and releases, testing, etc. It is available in 2 forms:on-premises and online. It uses SQL Server as a back-end for managing everything. In this article, we will be using TFS that will be installed on the local server.

What is a project Collection or simply a collection in TFS?

A collection or project collection is a group of projects that share a common logical or physical resources. In TFS we can have multiple team projects but not all of them require same requirements or objectives, so we can group all the projects that have similar requirements and objectives into a collection. In TFS every collection has a separate database, have a separate code base, user groups, etc.
 
How to create a new collection?

When we install TFS in a machine a "Defaultcollection" is created, so in this article, we will learn how to create a new collection in TFS.

To create a new collection open “Team Foundation Administration Console”.

Visual Studio 

Click on "Create Collection" button. This will open up Create Team Project Collection, as shown below.

Visual Studio 

Enter the collection name and description and click Next. The wizard will open up a window to provide SQL SERVER database instance and provide us an option to create a new database or select an existing empty database. Each collection has its own database, so we will select “Create a new database for this collection” radio button and click Next.

Visual Studio 

In the Review Configuration window, click “Verify”. After verification is done click the “Create” button . This will take some time to complete.

Visual Studio 

Click “Complete” button and then “Close” button. Now, we have our new collection added to the Team Project Collections.

Visual Studio 

Now we have a “DevOps Collection” ready and online, we will add a new project to the collection.

To create a new project in “DevOps Collection”, go to TFS URL and click the gear icon. This will open up TFS admin page .Select the collection from left menu and click “View the collection administration page” link. Alternatively, we can go to the URL “http://servername:8080/tfs/collectionname/_admin”.

Visual Studio 

Select the “New Team Project” link. A new “Create New Team Project" modal dialog will open up. Enter the project name, description, process template and version control as Team Foundation Version Control and click “Create Project” button. We can also select GIT as version control.

Visual Studio 

After the project has been created go to the TFS home and we can find the “TFSAutoBuild” under “Recent projects & teams”. Click on the project and it will take you to the project dashboard as shown below. This page contains various menu items like code, build, test, release, etc.

Visual Studio 

Now we will create and add the project to this team project.

For the purpose of this demo, I have created a simple asp.net MVC application.

Visual Studio 

We will now add this project to the “DevOps Collection”. Open Team Explorer in Visual Studio and click “Manage Connections” link.

Visual Studio 

In connect to project window click add TFS Server link. Provide the TFS Server URL and click Add. This will show the list of all project collections. Select “DevOps Collection” and click “Connect” button.

Visual Studio 

Right-click on the solution and select “Add Solution to Source Control”. After the solution has been added, right-click on the solution and click “Check In”. After the code has been checked in, it will appear under the code link. 

Visual Studio

 

 So in this demo, we created a new collection in TFS and added a project to it.