Automating The Building Of UWP Project Using Jenkins

Here are the steps to automate the building of UWP project using Jenkins. Jenkins is an open source tool:

Step 1: Go to your Jenkins Portal and click on New Item on the left.

jenkins

Step 2: Select Freestyle Project and give a Item Name and then click on OK.

 Freestyle Project

Step 3:

This is the place where you do the configuration stuff e.g. Source Code Management, etc.

Give a Description if you want.

Description

Step 4:

This is where the fun begins. Scroll down to Build and click on Add Build Step -> Execute Windows Batch Command.

Build

Step 5:
 
This step is basically for restoring Nuget packages before the project is actually built. Enter the following in the Command box:

NuGet.exe restore "Path_To_Solution" -ConfigFile "path_To_Nuget_ConfigFile" –NoCache

In my case it looks like:

command

Step 6:

Again click on Add Build Step and click on Windows PowerShell [Please Note: For this you should have PowerShell plugin for Jenkins Installed].

Add Build Step

Step 7:


This step is basically for the building of the UWP Project. Add the following code to the Windows PowerShell Command box:

#############################################################################
# Path to Msbuild tool
# $msbuild = "[Path to MsBuild.exe. See below for reference]"
$msbuild = "C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe"
set-alias msbuild $msbuild
# solution settings
# $sln_name = "[Path to Solution File. See below for reference]"
$sln_name = "C:\Users\Saurabh\Documents\Visual Studio 2015\Projects\uwptry\uwptry.sln"
$vs_config = "Release"
$vs_platfom = "ARM"
# call the build method
Write-Host "Building solution`n" -foregroundcolor Green
msbuild $sln_name /t:Build /p:Configuration=$vs_config /p:Platform=$vs_platfom /v:q /nologo
#############################################################################

This is how it looks:

build

Step 8: Click on Save.

save

Step 9: Now click on Build Now on the left side.

Build Now

Step 10: The build process starts. The build is in progress.

progress

Step 11:

If it’s a Sunny day out and you have always done good deeds, the build is successful just like in my case. If the ball is red in color, build failed.

red

Step 12:

Click on the Build number (#1 in my case). Now click on Console output to see the build process.

console

Step 13: As we can see from the Console output  the build was successful. We can also infer other important information from the Console output.

Console output

Read more articles on UWP:

Up Next
    Ebook Download
    View all
    Learn
    View all