Step 1: Go to your
Jenkins Portal and click on
New Item on the left.
Step 2: Select
Freestyle Project and give a Item Name and then click on OK.
Step 3:
This is the place where you do the configuration stuff e.g. Source Code Management, etc.
Give a Description if you want.
Step 4:
This is where the fun begins. Scroll down to
Build and click on
Add Build Step -> Execute Windows Batch Command.
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:
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
].
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:
Step 8: Click on Save.
Step 9: Now click on
Build Now on the left side.
Step 10: The build process starts. The build is in 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.
Step 12:
Click on the Build number (#1 in my case). Now click on
Console output to see the build process.
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.