This post is divided in a series of parts to demonstrate how packaging Desktop applications to MSIX using Jenkins.
Parts:
- Setup the Jenkins environment: install Jenkins and the required tools.
- Packaging a Visual Studio solution: for applications that use Visual Studio IDE, like Windows Forms and WPF.
- Packaging a solution developed outside Visual Studio: for applications developed outside VS, i.e., in others IDEs like Eclipse or Visual Studio Code, for Java GUI application.
- Packaging using the VB6RegistryTool: despite of the name, the tool can be used by any technology.
In this first part it is demonstrated how to setup the Jenkins environment.
I am not a Jenkins specialist, thus the idea here is to keep it simple and only demonstrate the basics to create a Jenkins Pipeline to package an application to MSIX. This post don't have the pretension to describe the best-practices to setup a Jenkins environment.
You can skip this section in case you already have Java SDK installed.
Jenkins supports Java 1.8 and 11 or OpenJDK. I am using OpenJDK, as in the Jenkins' Java requirements page it is describes that Jenkins project performs a full test flow with OpenJDK.
You can download OpenJDK 11 (Eclipse Temurin JDK more specifically) from the adoptium.net site or through this directly link.
Run the OpenJDK setup and click on Next to start the setup:
Enable all the options and click on Next again.
Click on Install to start installation:
Click on Finish to complete the installation:
More details about Java requirements here.
You can skip this section, in case you already have a basic installation of Jenkins server.
As we want to package a MSIX package, we need to download Jenkins for Windows. You can download the stable release (LTS - Long-Term Support) here.
Run Jenkins installer and click Next to start the setup:
Click again on Next, as we are keeping the default folder:
The next step is to setup the user account credentials for Jenkins.
To keep it simple, I am using my local administrator user that has Log on as a service permission. More information about how to enable service logon here.
Click on Test Credentials to validate the credentials, once validated, click on Next:
Now we need to define the port number for the Jenkins service. I am using the default setting that is 8080. Click on Test Port and on Next after having validated the port number:
The next step is to define the Java home directory (JDK or JRE).
Click on the Change button and provide the Java home directory:
Click on Next as we are using the default settings:
Finally, click on Install to start installation:
Click the Finish button to complete the installation.
Open a browser and pull up port 8080 on localhost, as this is the port number we used previously to setup Jenkins. The getting start screen is presented making reference to the initial admin password:
Copy the password from the file initialAdminPassword displayed on the screen and paste it in the Administrator password field. Then click on the Continue button.
To keep it simple we will install the suggested plugins, as we can come back later and add in more plugins:
As the plugins install, a green check mark appears:
The next step is to create the admin user. Click on *Save and Continue after filling up the fields:
The last step is to set the Jenkins URL. Click Save and Finish to complete the setup.
Click on Start using Jenkins :
You will be prompted to add the Jenkins credentials created earlier:
The default Jenkins page is displayed:
You can skip this step in case you don't have projects on Visual Studio and you are not considering using Windows Application Packaging Project.
Visual Studio will be used in the following scenarios:
You can download Visual Studio 2022 here.
Feel free to install the components that best suit to our scenario.
I installed .NET desktop development and Universal Windows Platform since those projects will be used to build a WinForms App and to package it to MSIX through the Windows Application Project.
In addition, make sure that the Windows 10 SDK 10.0.19041.0 is selected, as we are targeting our MSIX package to that Windows 10 operating system build.
Click on Install to start installing Visual Studio.
This step is optional in case you don't want to pull the code from GitHub repository.
You can download Git for Windows here.
The installation is straightforward and we are use the default settings.
Click Next to start the installation:
Select the folder where Git should be installed and click on Next to proceed:
Feel free to customize your installation. Click Next to proceed:
Here you can customize the Git shortcut. Click Next to proceed:
Now you can define which editor would you like Git to use. Click Next to proceed:
I choose the second option to name the initial name to main. Click Next to proceed:
I am using the default recommended option to adjust my PATH environment:
I am using the Default first option for OpenSSH, i.e., use ssh.exe that comes with Git:
I am using the Default option for HTTPS connections:
In this step we need to choose how Git will treat the line ending in text files.
Here I choose using Windows' default console window for Git Bash:
I am using the default option for git pull:
Now, we need to set the credential helper:
I am enabling the default file system caching:
Finally, click on Install to install Git for Windows:
Click on Finish to complete the installation.
Now that Git is installed, switch back to Jenkins, click on Manage Jenkins and Global Tool Configuration to configure the MSBuild plugin:
In the Git session, make sure that Jenkins is recognizing the path to Git executable. In my case, Jenkins couldn't find the git.exe:
I fixed it by including the full path where Git for Windows is installed:
Click on Save to fix the Git path.
Click on Manage Jenkins and Global Tool Configuration to configure the MSBuild plugin:
Click on Add MSBuild available in the MSBuild session:
Switch back to Jenkins, click on Manage Jenkins and Global Tool Configuration to configure the JDK plugin:
Scroll-down to the JDK session, click on Add JDK, provide the name JDK 11, uncheck the Install automatically checkbox, and provide the JAVA_HOME path:
The first step is to download Maven that is available here.
Download the Binary zip archive:
Extract the zip file in a folder of your preference. I am using the following one:
Create a MAVEN_HOME environment variable pointing to your Maven installation folder:
Include the %MAVEN_HOME%\bin to the PATH environment:
Click on Manage Jenkins and Global Tool Configuration to configure the Maven plugin:
Scroll-down to Maven section and click on Add Maven:
Provide the name Maven 3.8, uncheck the Install automatically checkbox, provide a value for the MAVEN_HOME, and click on Save:
The following repo msixdemos will be used in our three scenarios.
In case you want to use the same repo, my suggestion is that you fork the same so you can have more access and permissions.
The first step is click on profile settings:
In the Public profile page from GitHub account, click on Developer settings:
Click on Personal access tokens and then click on Generate new token button:
In the New personal access token page, let's name the new token to Jenkins.
We can give it a lot of different permissions, but I want to provide just the permissions needed by Jenkins for GitHub integration.
I have set up the following scopes:
Click on the Generate token.
The token will only be displayed once, so make sure to save this off:
Switch back to Jenkins, click on Manage Jenkins and then Configure System:
Scroll down to the GitHub section, expand the Add GitHub Server and click on GitHub Server:
Let's call it to GitHub Connection and under Credentials, let's add a new Jenkins credential:
In the Add Credentials page, select the Secret text kind, and paste in the Secret field the personal access token generated previously on GitHub. Name the ID field to GitHubToken and click Add.
Under Credentials select the GitHubToken and test the connection.
Once it works, click on Save to complete the integration of GitHub with Jenkins.
In the Part 2 it is demonstrated how creating pipeline on Jenkins.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.