How to install and configure Jenkins to build dot.net core applications from Azure Devops?

In this blog, we will go through practical steps to install and configure Jenkins to run on windows VM by using Azure Devops Repos.

Prerequisites

  • Azure Repo with an error-free dot.net core application.
  • A Windows VM

Download and install:

1. Go to url: https://www.jenkins.io/download/

2. Scroll down and click on download for Windows:

3. After downloading start installation at suitable location:

4. After installation, Jenkins will be running at default port: http://localhost:8080/

5. Copy the password from the mentioned location and paste in the text box to login.

6. Click on Install Suggested plugins.

7. Enter the details of default user:

8. Jenkins installation is done and the homepage will be displayed:

Install and configure plugins:

Pre-requisite- Github, MS Visual Studio, or MSBuild.

1. Go to the Homepage and click on Manage Jenkins.
2. Select Manage Plugins.
3. Search for MSBuild, select it and click “Install without restart”.

4. Go to the Homepage and click on Manage Jenkins. Select “Global Tool Configuration”. Update already installed GitHub path.

5. Scroll down and click on “MSBuild installations”. Give a suitable name(For example “VisualStudio” given in screenshot) and update the path of MSBuild.
For Visual Studio 2019 the default path is “C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin”.
For Visual Studio 2017 the default path is “C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin”.

6. Save the changes.

Create and build a project using Azure Devops:

Prerequisite: Go to Azure Devops and create a Personal Access Token(PAT) for Jenkins.

 

1. Go to the Homepage and click on New Item.
2. Select Free Style Project, Give a suitable name and click Ok.
3. Click on Configure in the left side menu.
4. Go to Source Code Management -> Git .
5. Enter the Repo URL in the provided space and then click on “Add” button in front of Credentials.
6. In the dialog box, Enter Username as “Token” and in password field enter PAT generated from Azure Devops

7. Select the Branch name in “Branches to build section.”
8. Apply and save changes.
9. Click on Build Now to check if able to clone the project successfully to Workspace.

Build a solution using MSBuild:
1. Open the project and Go to Configure.
2. Scroll down and click on Add Build Step and Select “Execute Windows Batch Command ”

3. Click on Add Build Step and Select “Build a Visual Studio project or solution using MSBuild ”

4. Select the MSBuild installation done in previous steps and mention the name or path of solution/project to build.

 

5. Build the solution.

Leave a Reply

Your email address will not be published. Required fields are marked *