How to build an unsigned Jenkins MSI on your Windows machine
Should you ever need to rebuild a Jenkins MSI on your Windows machine, here is a way to do it.
Jenkins WAR file
First, you should download the Jenkins war file that will be inside the MSI file. You can access it from the official Jenkins website or from the Jenkins update center.
Check the Jenkins download page to download the latest weekly version of Jenkins for example. You can always access the direct link to get the latest weekly version, but you won’t necessarily know which version number you are using. Just saying.
There are quite a few ways to install Git on Windows, but the most straightforward way is to see what the official Git website recommends.
You can install MSBuild from Visual Studio or from the Build Tools for Visual Studio.
This command line tool is used to build the MSI file.
Install .NET Framework 3.5
You may already have it installed on your machine, but not activated. You can activate it from the Windows Features dialog box.
To access this dialog box, press the keys ⊞ Win + R, then enter the command
appwiz.cpl and push enter.
Turn Windows features on or off.
.NET Framework 3.5 entry and install.
|now run Windows Update to check for security updates.|
If it is not installed yet, you can install .NET Framework 3.5 from the Windows Features.
Check if you have PowerShell
In recent versions of Windows, PowerShell is already installed and accessible through the terminal application.
At the time of writing, the pre-installed version is
You can also install the latest version from the Microsoft Store (7.3.2 at the time of writing).
You could also install PowerShell from GitHub by issuing the following command:
winget show "Microsoft.PowerShell" -s winget
This would give an output similar to:
Found PowerShell [Microsoft.PowerShell] Version: 18.104.22.168 Publisher: Microsoft Corporation Publisher Url: https://github.com/PowerShell/PowerShell/ Publisher Support Url: https://github.com/PowerShell/PowerShell/issues Author: Microsoft Corporation Moniker: pwsh Description: PowerShell is a cross-platform (Windows, Linux, and macOS) automation and configuration tool/framework that works well with your existing tools and is optimized for dealing with structured data (e.g. JSON, CSV, XML, etc.), REST APIs, and object models. It includes a command-line shell, an associated scripting language and a framework for processing cmdlets. Homepage: https://microsoft.com/PowerShell License: MIT License Url: https://github.com/PowerShell/PowerShell/blob/master/LICENSE.txt Copyright: Copyright (c) Microsoft Corporation Copyright Url: https://github.com/PowerShell/PowerShell/blob/master/LICENSE.txt Release Notes Url: https://github.com/PowerShell/PowerShell/releases/tag/v7.3.2 Tags: command-line cross-platform open-source powershell pwsh shell Installer: Installer Type: wix Installer Url: https://github.com/PowerShell/PowerShell/releases/download/v7.3.2/PowerShell-7.3.2-win-x64.msi Installer SHA256: a4f7d081c5f74bc8d6c75f1dfee382b7fd9335361181748fee590ecdbc96cb26 Release Date: 2023-01-24
You can see that the latest version is
7.3.2 and that the installer is a
.msi file located on GitHub.
Just follow the link provided with your browser and install PowerShell from this file once it has downloaded.
Build the MSI
Clone the Jenkins packaging repository
git tool and clone the Jenkins packaging repository on your machine.
Prepare the build
terminal window and go to the folder where you cloned the repository.
You now have to declare where you downloaded the Jenkins war file, so the build script can find it.
$env:War = "$env:USERPROFILE\jenkins.war"
If you have previously moved it into your repository clone folder, you can use this command instead:
$env:War = "C:\jenkinsci\packaging\msi\build\jenkins.war"
Build the MSI
Enter the subfolder
msi\build and run the following command:
You should get an output similar to:
Extracting components JenkinsVersion = 2.392 Restoring packages before build All packages listed in packages.config are already installed. Building MSI MSBuild version 17.4.0+18d5aef85 for .NET Framework Build started 01/12/2022 20:53:30. Project "C:\jenkinsci\packaging\msi\build\jenkins.wixproj" on node 1 (default targets). SetConstants: EncodedVersion = 2.255.3920 Compile: Skipping target "Compile" because all output files are up-to-date with respect to the input files. AssignCultures: Culture: en-US Link: C:\jenkinsci\packaging\msi\build\packages\WiX.3.11.1\build\..\tools\Light.exe -out C:\jenkinsci\packaging\msi\build\bi n\Release\en-US\jenkins-2.392.msi -pdbout C:\jenkinsci\packaging\msi\build\bin\Release\en-US\jenkins-2.392.wixpdb -sw1076 -cultures:en-US -ext C:\Support\users\jenkinsci\packaging\packaging\msi\build\packages\WiX.3.11.1\build\..\tools\\WixUIExtension.dll -ext C:\jenkinsci\packaging\msi\bu ild\packages\WiX.3.11.1\build\..\tools\\WixNetFxExtension.dll -ext C:\jenkinsci\packaging\msi\build\packages\WiX.3.11.1\build\..\tools\\WixUtilExtension.dll -ext .\msiext-1.5\WixExtensions\WixCommonUIExtension.dll -ext C:\jenkinsci\packaging\msi\build\packages\WiX.3.11.1\build\..\tools\\WixFirewallExtension.dll -fv -loc jenkins_en-US.wxl -spdb -contentsfile obj\Release\jenkins.wixproj.BindContentsFileListen-US.txt -outputsfile obj\Release\jenkins.wixproj.BindOutputs FileListen-US.txt -builtoutputsfile obj\Release\jenkins.wixproj.BindBuiltOutputsFileListen-US.txt -wixprojectfile C:\jenkinsci\packaging\msi\build\jenkins.wixproj obj\Release\jenkins.wixobj Windows Installer XML Toolset Linker version 22.214.171.1248 Copyright (c) .NET Foundation and contributors. All rights reserved. jenkins -> C:\jenkinsci\packaging\msi\build\bin\Release\en-US\jenkins-2.392.msi Done Building Project "C:\jenkinsci\packaging\msi\build\jenkins.wixproj" (default targets). Build succeeded. 0 Warning(s) 0 Error(s) Time Elapsed 00:00:08.26
Locate the generated MSI file
The MSI file is located in the
In this folder, you will find the generated MSI file and its
ls Directory: C:\jenkinsci\packaging\msi\build\bin\Release\en-US Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 01/12/2022 20:53 105107456 jenkins-2.392.msi -a---- 01/12/2022 20:53 84 jenkins-2.392.msi.sha256