TFS Integration with Jenkins

TFS Integration with Jenkins

Written by AZHAGIRI PANNEERSELVAM, Associate Architect at Powerupcloud Technologies

What is TFS (Team Foundation Server)?

Team Foundation Server is a Microsoft product which provides source code management, reporting, requirements management, project management, automated builds, lab management, testing, and release management capabilities. It covers the entire Application Lifecycle Management. TFS can be used as a back end to numerous integrated development environments but is designed to provide the most benefit by serving as the back end to Microsoft Visual Studio or Eclipse.

What is Jenkins?

Jenkins is an open source automation tool written in Java with plugins built for Continuous Integration purpose. Jenkins is used to building and testing your software projects continuously making it easier for developers to integrate changes to the project, and making it easier for users to obtain a fresh build. It also allows you to continuously deliver your software by integrating with a large number of testing and deployment technologies.


Assume that we have a VPN tunnel between AWS and on-premise. The requirement is to download the code from on-premise TFS server via Jenkins and build the code using MSBuild and deploy to the AWS EC2 instances via AWS code deploy.

Proposed Design for the Integration

AWS services we have used in our design:

1. EC2 instances ( 2 Windows servers, one with IIS and code deploy agent installed, the other Windows server with Jenkins and Visual studio build tools installed).

2. AWS Code Deploy.

3. Simple Storage Service (S3).

4. IAM (Instance Role to upload the revision and call code deploy).

Note: — MSBuild plugin was not working as expected. Hence, we have planned to install the Visual studio Build tools on the server and mapped the installation path to make it work.

Other necessary details

1. TFS server Login details (This need to be created in the TFS server to connect the latest code from TFS).

2. Microsoft account Login details to download the visual studio tool for Jenkins

3. TFS Plugin on the Jenkins server

Step — 1 Installing Visual Studio Build tools on the Jenkins server.

Download the build tools for visual studio 2017 version 15.9 from the official Microsoft website

Note:- Use the Microsoft Login details to download the exe file.

While installing the Visual Studio tool you have to make sure you have installed the following components to make sure the Jenkins MSBuild plugin is working as expected.

· .NET desktop Build tools

· Data storage and processing build tools

.NET Core Build tools

Visual Studio Installation location

Base Location: C:\Program Files(x86)\Microsoft Visual Studio\2017\BuildTools

Note:- Make note of the Location. We will be using it in the steps below.

Step — 2 Install necessary plugins on the Jenkins server

Plugin Name

MSBuild Plug-in

Team Foundation Server Plug-in

AWS CodeDeploy Plugin for Jenkins

Mass Passwords Plugin

PostBuildScript Plugin

Use Plugin Manager to install the above Plugins on the Jenkins server.

Step — 3 Plugin Configuration in Jenkins

Once you have installed the Plugins from the Jenkins Plugin Manager. We need to configure the necessary plugins.

MSBuild Plugin Path configuration

In the Global tool configuration page. (Located in the Manage Jenkins). Find the MSBuild installation configuration. It looks as shown below. Make note of the Name. We will be using this in an upcoming step.

The explanation of the field below.

Name: Name of MSBuild configuration

Path to MSBuild: Kindly find the MSBuild exe file in the base location and paste it here.

Default parameters: Leave as blank

Once you have updated the details. Kindly save the configuration.

Step — 4 Integration of Jenkins with Team Foundation Server and build with MSBuild Plugin

Team Foundation Server login details configuration in Job

While Creating New freestyle project (Job) in Jenkins. In the Source code Management session you have to select the Team Foundation Version Control(TFVC) and give the following input to connect the TFS server project to get the latest code.

The explanation of the field below.

Collection URL: The URL to the team project collection

Project path: The path to the TFVC project must start with ‘$/’

Credentials: Username and password to connect TFS project.

Update the above details in the configuration and leave the other option as default.

Note: — Make sure you have unchecked the use update.

MSBuild configuration in job

In build session, we have to build the code with MSBuild plugin. Kindly choose the “Build a Visual Studio project or solution using MSBuild”

Once you have clicked, The Build box added as below. You have to select the version of the MSBuild. Make sure you have selected the one which you configured in the previous step.

Example Input for MSBuild configuration

MSBuild Version: MS Build VS 2015

MSBuild Build File: ${WORKSPACE}\exmple.sln (Make sure you select the .sln file to build the code).

Command Line Arguments

/p:Configuration=PROD /p:OutDir=”C:\Program Files (x86)\Jenkins\workspace\exampleJob\Output”

That’s it. Save the Job and execute it.

Now you have your build in the following location

C:\Program Files (x86)\Jenkins\workspace\exampleJob\Output”

Hope you found it useful. Happy Integrating 🙂

from Powerupcloud Tech Blog – Medium

Sharing is caring!

Comments are closed.