WPNinjas HeaderWPNinjas Header

How to create an MSIX right now in the Insider Preview. A step by step Tutorial

This Blogpost is a step by step guidance on how to crate and install an MSIX, with the current Windows 10 Insider Build. (Currently this is Build 17711)

To create/Snapshot a MSIX from an installer:

You need some things:

To Run /Install a MSIX trough double clicking it:

You just need the following:

  • Windows 10 Pro or Enterprise with at least Insider Build 17698
  • If you have used a self-signed certificate you need to install that one first to the “Trusted Root Certification Authorities” store on your test system.
  • Enable Sideloading

But let’s take it slow and start one step after the other.

How to prepare your Machine

I would recommend that you use a VM for creating your MSIX files. I use Hyper-V on my Windows 10 for that.

Once you have installed your VM with Windows 10 1803, you need to install and setup the other needed components.

Side Note:

In theory the VM for creating the MSIX could be enrolled in the Insider Preview.

But I had a lot of troubles with this. The Problem is that base Images for the Desktop App Converter are not released in the same interval as the Insider Builds.

As an example, the current Fast Ring Build is 17711 but the base Image is only available for the Version 17686 and that will not work with 17711.

Installing the Desktop App Converter:

You need to install the Desktop App Converter from the Store

Klick on https://aka.ms/converter or Search for “Desktop App Converter” in the Microsoft Store.
Click on Get

Base Image:

Now you need to get a base WIM against which you will later install your
application.

This is needed since the Desktop App Converter uses Container technologies for snapshotting the Apps you want to convert.

Got to https://www.microsoft.com/en-us/software-download/dac
There you need to select the right Image for your Build.
Since I use a Windows 1803 VM I download the Build 17134 Image to my downloads folder.

ADK:

To get the insider Preview ADK go to https://www.microsoft.com/en-us/software-download/dac and download it.
Once the ISO is downloaded, mount it by double clicking on it.
Now you will get a new CD-ROM drive.
Open that one.
There you will find the “WinSDKSetup.exe”.
Start that EXE.
You just need to install the following features:

  • Windows SDK Signing Tools for Desktop Apps
  • Windows SDK for UWP Managed Apps

First you need to Setup you DAC (Desktop App Converter)


 
You need to start des Desktop App Converter as Administrator
  Then you first need to setup your environment.
To do that you enter DesktopAppConverter.exe -Setup -BaseImage %PathToYourBasIMAGE% -verbose
In my case that is

DesktopAppConverter.exe -Setup -BaseImage “C:\Users\admin\Downloads\Windows_BaseImage_DAC_17134.wim” -verbose

The -verbose switch is optional, it just lets you see more of the behind the scenes magic.

When you haven’t already enabled the Containers feature, the setup will do that for you, but in that case, you need to reboot during the setup.


Once the Setup has enabled the feature, it will ask you to reboot.
Enter Y and hit Enter.

The setup is now restarting your computer.

  As soon the restart is done, you can login again and the setup will automatically continue.
When you see the line “Expanding Bas Image” then it’s time to stretch your legs and get a cup of coffee or a glass of water, because this is going to take some time.
  When the Setup is completed, I would recommend that you restart your machine and then take a VM Snapshot.

Create a MSIX

When you have finished the setting up part, then you are now ready for creating an MSIX.

Prepare your Setup

I decided to use FileZilla Client as the software I want to deploy with MSIX. For those of you that don’t know it, it’s a free FTP Client.

You can download it from here.

We cannot convert a Setup while clicking trough it’s GUI for now, so we need a way to silently install it without user interaction.

I first had to find out how to install FileZilla silently. This can be done like that “FileZilla_3.34.0_win64-setup_bundled.exe /user=all /S”

So, I created a little batch. (Yes, I know that is not fancy and cool, but it does the job and is written in no time)

That batch just contains, the following line:

%~dp0FileZilla_3.34.0_win64-setup_bundled.exe /user=all /S

The batch needs to be stored in the same folder as the FileZilla exe.

First, I have then tested that batch on the VM (Remember that I told you to make a VM Snapshot after setting everything up).

When everything works like a charm you can proceed to converting your Setup

Convert your Setup

Copy the setup and the Batch to the VM
  Then you need to create a folder where the output of the converter should be stored.
I use the folder “Converted”.
  You need to start des Desktop App Converter again as Administrator
To convert the setup, use the following command:
DesktopAppConverter.exe -Installer %YourInstaller% -Destination %WhereTheOutPutGoes” -PackageName “%PakageName%” -Publisher “CN=%PublisherName%” -Version %VERSION%
In my example this would be:

DesktopAppConverter.exe -Installer “C:\Users\admin\Desktop\Setup_Files\Install_FileZilla.bat” -Destination C:\Users\admin\Desktop\Setup_Files\Converted -PackageName “FileZilla” -Publisher “CN=TimKosse” -Version 3.34.0.0

Then you can press enter.

The Example shows the optional parameter -MakeAppx. But we don’t use that one, since we want a MSIX at the end and we want to see what the output looks like and perhaps make adjustments bevor creating the MSIX.

You could also use the -verbose switch here to get more insights on the background magic.

Attention: The Version needs to have the following schema Major.Minor.Build.Revision

You need to have four dots in it. Not more not less!

It then takes some time while your app gets installed against the base WIM and after that the conversion starts.
When everything is done you get a success message like this one.

Review the Output

You can now look at the result, that is stored in the output folder you defined with -destination.
Here you get a folder that’s named after what you specified with -PackageName
In there you get the folder “logs” and the one that really interests us, the folder “PackageFiles”
In here we have all the things our installer putted on the base WIM. For those of you that already know App-V. you see a lot of similarity.
(Manifest.xml, Registry.dat, VFS)
But for now, that’s enough poking around in the output and we save us the details for another blogpost.
Later in the process we just need the path to the PackageFiles folder.

Certificate

Microsoft said that in the final version of MSIX you could decide and configure on your clients if your packages need to be signed or not.

For now, this is not the case and you need to sing them.

If you already have a valid code signing or a self-singed certificate you don’t need to do these steps but when not follow them to create a self-singed certificate.

You can use the following PowerShell code to generate and export a self-singed certificate and adjust it to your scenario.

$YourPublisher = 'CN=TimKosse' #This needs to be the same value you used with DesktopAppConverter.exe as the -publisher parameter, when converting your setup 
$FirenldyName = 'FileZilla MSIX Test Cert'
$password = 'pass-word1' #Remember that one, you need it again when signing your MSIX
$FolderToExportCert = 'C:\Users\admin\Desktop\Setup_Files' #The folder already needs to exist
$CertName= 'FileZilla' #The Filename your Cert should have

#---------------------------------------------------------------------

$PFXName= ($FolderToExportCert +'\' +$CertName +'.pfx')

$cert = New-SelfSignedCertificate -Type Custom -Subject $YourPublisher -KeyUsage DigitalSignature -FriendlyName $FirenldyName -CertStoreLocation 'Cert:\CurrentUser\my'
$pwd = ConvertTo-SecureString -String $password -Force -AsPlainText 
$cert | Export-PfxCertificate -FilePath $PFXName -Password $pwd
remove-item $cert.PSPath 


Now copy that certificate away since you may need it later.

Create a MSIX

If you are still reading, I promise creating your first MSIX has never been closer. So, hang on, we are almost done.

Now you need to browse to where your SDK was installed and the “makeappx.exe” lives.
In my case that is
“C:\Program Files (x86)\Windows Kits\10\bin\10.0.17704.0\x64\”
Now make a right klick on the “makeappx.exe” and select copy as path.
Then you need to create a folder where the MSIX should be stored.
I use the folder “MSIX”.
Now open a cmd window and paste that path you just copied.
Then you need to enter ” pack /d %PahtToPackageFilesFolder% /p %PathAndPackageName.msix”
In my case that is:
“C:\Program Files (x86)\Windows Kits\10\bin\10.0.17704.0\x64\makeappx.exe” pack /d C:\Users\admin\Desktop\Setup_Files\Converted\FileZilla\PackageFiles /p C:\Users\admin\Desktop\Setup_Files\MSIX\FileZilla_3.34.0.msix
Then press the enter button.
Once you see the line “Package creation succeeded” it’s done we have created an MSIX.
But wait, now we need to sing it first. For that we need the tool SignTool.exe that was also installed with the SDK.
It is in the same folder as the makeappx.exe.
You now need to execute the following command.
signtool.exe sign /fd SHA256 /a /f %PathToYourCert% /p %YourCertsPassword% %PathToYourMSIX%
In my case this is

“C:\Program Files (x86)\Windows Kits\10\bin\10.0.17704.0\x64\signtool.exe” sign /fd SHA256 /a /f “C:\Users\admin\Desktop\Setup_Files\FileZilla.pfx” /p pass-word1 “C:\Users\admin\Desktop\Setup_Files\MSIX\FileZilla_3.34.0.msix”

No hold your breath (This is the final Step) and hit that Enter button.

When everything went well you see the Massage “Successfully signed:”
You can now open the folder you specified to store the MSIX and finally get that MSIX.


You see that for now we don’t have a fancy icon for the MSIX. That’s because we are now on an 1803 System.
If this would be an Insider Preview System, with at least Insider Build 17698, we would see a nicer icon.

Now quickly copy that precious MSIX away from your VM. I also recommend coping away the logs and PackageFiles folders from the setup conversion. You may need those later on for troubleshooting and problem fixing.

Testing the MSIX

Now it’s time to test the MSIX. for that you need a System with at least Insider Build 17698 (Or 17692 if you only want to install trough PowerShell and not by double clicking)

Enable Sideloading

Before you can install an MSIX you need to enable sideloading. This is also something that I assume will change in a final version.

Open “All Settings”
Go to “Updates & Security”
Go to “For developers” and check the radio button for “Sideload apps”
Now click on “Yes”

Install the Certificate

When you signed your MSIX with a self-signed Certificate you must perform the following steps.

If you have a valid code signing certificate you can skip this part.

copy your MSIX to that System.
Now right click on the MSIX and select “Properties”
Change to the “Digital Signatures” tab and select your signature and then click on “Details”.
Now click on the “View Certificate” button.
Now click on the “Install Certificate…” button.
Select “Local Machine” and click on the “Next” button.
Click on the “Yes” button.
Select the “Trusted Root Certification Authorities” Store and click on the “Next” Button.
Click on “Finish”
Click on OK

Install the MSIX

When you have not already done so in the previous step, copy your MSIX to that system.
Now you get that fancy Icon.
Just double click on the MSIX File.
You can now see all the parameters we provide previously.
The publisher the version, and it even detected the right Icon.
Now hit that “Install” Button.
Now FileZilla gets installed
And now the moment we waited so long and worked so hard for, has finally come.
FileZilla runs and is deployed as an MSIX.
It is also integrated in our start menu

If you prefer that, you could also install it with PowerShell.

To do this use: Add-AppxPackage %PathToYourMSIX%

In my case:

Add-AppxPackage “C:\Users\admin\Desktop\FileZilla_3.34.0.msix”

Uninstall the MSIX

Since we are good packaging engineers and take our job seriously we also test the deinstallation

For now, this can only be done with PowerShell


Get-AppxPackage Filezilla | Remove-AppPackage

And now FileZilla is gone.

Final thoughts

So, you see creating an MSIX is at the moment not that easy.

When you have already one used the DAC to create an appx bevor, you have seen that the only difference is the file extension .msix. The rest of the steps are the same for an .appx.

I think right now we need to wait a bit longer and see what Microsoft is really releasing in the next Windows 10 Build.

I’m also eagerly awaiting MSIX support from the 3rd party packaging tool developers like Advanced Installer and others.
Those companies already made creating an appx a lot easier, then it is with Desktop App Converter solution.

I recommend you create your own MSIX for testing purpose but, really wait bevor starting mass conversion.

6 Comments

Nona · July 12, 2018 at 19:31

Great tutorial! Shows the e2e process very well.

    Pascal Berger · July 13, 2018 at 08:03

    Hi Nona,
    I fell honored that you took your time to look at the tutorial and comment on it.

Jody · July 13, 2018 at 18:09

Thank for this! I will have to give it a try. Any ideas on the conversion of .appv packages?

    Pascal Berger · July 13, 2018 at 21:56

    Right now, there is no official solution for that. Microsoft promised they will give us something to do that in the future. But I don’t expect that solution to be released this year.

Rkast · July 13, 2018 at 20:18

Hi Pascal, Thank you for this detailed step by step. Will defenitly try this out!

    Pascal Berger · July 13, 2018 at 21:57

    You are very welcome. Pleas let me know if it works for you.

Leave a Reply

Avatar placeholder

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.