Getting started with Microsoft Team Foundation Server

Introduction

Team Foundation Server (TFS) is Microsoft’s software engineering tool that offers the following:

  • Versioning System – Source code management via centralized or distributed version control system. Offers unlimited and secure Git and Team Foundation Version Control (TFVC) repositories.
  • Agile project management – Enable your custom agile processes. Capture, prioritize, and track work with backlogs and customizable Kanban boards. Ensure transparency and traceability with work items linked directly to code and builds.
  • Continuous Integration – You can completely automate the Software lifecycle by Implementing continuous integration, continuous deployment and release process.

To get you started with TFS, we have written a  beginner’s guide that provides step by step instructions on the following:

  • Installing TFS
  • Configuring the build service
  • Creating Team project, TFVC repository and checking in files
  • Importing projects from TFVC into Eclipse
  • Configuring a build job based on Apache ANT scripts

Installation

1. Download setup of Microsoft TFS from this link

2. Run the downloaded file and proceed with the installation process as shown in the below screenshots:

TFS installation 1.png
TFS installation 2.png

Once the installation is complete, TFS configuration center screen will appear. This will allow us to configure it for the first time. Follow the steps as shown in the below screenshots:

TFS installation configuration 1.png
TFS installation configuration 2.png

3. If you already have SQL Server 2012 installed, choose “Use an existing SQL Server Instance”.

TFS installation configuration 3.png

4. You will be asked to enter the name of the current SQL Server instance. This will be entered in the following format: Server Name\Instance Name

5. Review the configuration details before moving forward. Click on the Verify button to verify the installation and dependencies:

6. Press Configure to continue.

7. Press Next:

TFS installation configuration 4.png

8. Once the installation is complete the TFS Administration Console will open up as shown in the below screenshot:

TFS installation configuration 5.png

9. To check whether TFS has been installed properly, open a web browser and enter the following web console URL
http://localhost:8080/tfs

tfs console.png

Click on “Administer Team Foundation Server”:

Example admin console URL: http://localhost:8080/tfs/_admin

tfs console admin.png

Build Service Configuration

TFS comes with several pre-installed features with the initial setup, however, in order to use a service you are required to configure it and provide configuration parameters to make it fully functional.

1. Go to Start -> Microsoft Visual Studio Team Foundation Server 2013 -> Team Foundation Server Administration Console. The following window will be opened. Click on “Configure Installed Features”.

TFS build configuration.png

2. Click on “Start Wizard”.

3. Press Next.

TFS build configuration 1.png

4. Keep the below settings as default and press Next.

5. Keep the “Use the default setting” selected and press Next.

6. Keep the default option selected and press Next.

TFS build configuration 2.png

7. The next window shows a review of the Build Service settings. Click on “Verify”.

8. Click on “Configure”.

9. Once the Configuration is completed, press Next.

10. Close the window once configuration is completed.

Adding administrator user and setting permissions

Now, we add a new member in TDS as a project and build administrator

1. Go to TFS admin panel.

Example:

http://localhost:8080/tfs

2. Click on “Administer”.

Under Administration Tasks, click on “Manage collection security and group membership”.

Click on “Project Collection Build Administrators”.

3. Click on “Members

4. Click on “Add” -> “Add Windows User or group” -> “Browse

5. Select your user and click on add.

6. Change permissions and add your user to Administrators.

7. Your user needs to be added in both “Project Collection Administrators” and “Project Collection Build Administrators”. You’ll need these permissions in order to create a team project and define/configure a build.

Creating team project

Now you have to add a project in order to establish a repository for the source code and a place for a group of developers and teams to plan, track progress, and collaborate on building software solutions.

1. Go to TFS admin console.

2. Choose the VSTS icon to open the Projects page, and then choose Create Project.

3. Fill out the form provided. Provide a name for your new project, select TFVC as the source control type, select a process, and choose with whom to share the project.

Using Eclipse to Connect to TFS Team Project repository and check-in files

1. Download & Install Team Explorer Everywhere 2013 Eclipse Plugin.

2. Open Eclipse.

3. Go to Window -> Show View -> Team Foundation Server -> Team Explorer

4. Click on Connect to TFS. Select newly made project. Click on Finish.

Once connection is made the TFS view would be like the following:

5. Click on Source Control Explorer.

6. Select Project name. Right click in the source control window and click on “Add items to folder”. Following window would appear:

TFS eclipse 1.png

7. Click on Browse and select the files/folders that you want to commit into the TFSVC repo. The folders you add are usually the project folder of your application containing the source code and resource.

TFS eclipse 2.png

Click on Next.

TFS eclipse 3.png

Click on Finish

Once the desired files are added, they would be displayed in the source control window. Please note that these changes are not yet checked-in into the source control.

8. Click on ‘Pending Changes’ on the Team Explorer view. All the files that you have just added would be displayed here:

TFS eclipse 4.png

9. Click on Check-In. These changes would be checked in into the source control. Make sure all changes are included and nothing is excluded.

TFS eclipse 5.png

Checkout projects from TFS

Once you have installed the eclipse plugin you should be able import projects from Team foundation version control repository.

1. Click on File > Import

2. Under Team -> Click on Projects from Team Foundation Server

TFS eclipse import project.png

Click on Next.

3. Select the workspace and press Next

4. Select project that you want to import from the collection. Press Next

Once import is complete, the entire project would be checked out from the TFS server and would be displayed in eclipse.

Automated Build

You can use eclipse to create automated builds as a part of continuous integration process.

1. Under Team Explorer view, click on Builds > New Build Definition.

2. In General, Enter build definition name and description.

3. Under Trigger tab, enter the build trigger options as per requirement. You can either build manually or can trigger a new build upon every check in. Select the desired option.

TFS automated build.png

Every build definition makes a project file after successfully configuring a build definition.

4. Under Source Settings, select the workspace where you want the project file to be made.

5. Under the Build Defaults tab, enter the Build Controller that was configured while TFS installation.

6. As mentioned earlier, a project file is needed for every Build definition. This project file requires the ANT/MAVEN build script and makes a .proj file as a result.

TFS automated build 1.png

In case a workspace already contains a project file, you can use the existing one.

Click on Create.

7. Select whether you want to use an ANT/MAVEN build script.

Press Next.

8. Provide the path to the build.xml file. (Assuming you have the build.xml already written for building your projects)

TFS automated build 2.png

9. If you have the build file committed in source control, you can select it from there. If you build script is dependent on a properties file (build.properties) then please make sure both build and properties files are placed in the same folder.

Press Next.

10. Choose specific versions of JAVA and ANT installed OR use Default if you already have the ANT_HOME and JAVA_HOME environment variables saved.

TFS automated build 3.png

11. Press Finish. Specify the Retention Policy.

Press OK.

12. Once the build definition has been configured, you will be able to see the build definition under the All Build Definitions tab in Build view.

13. To trigger a new build, right-click on the build definition and click on Queue New Build.

Click on Queue.

Once the build is in process, following will be displayed.

TFS automated build 4.png

14. Right click on it and click on Open in External Browser.

15. Click on Logs to view the TFS logs.

Once the build is successful, the indication would turn green

Muhammad Ali

Bluestack IT Solutions

 
 
Muhammad Ali