Simplify MSIX image creation with the MSIXMGR tool

Microsoft

 

Simplify MSIX image creation with the MSIXMGR tool

 

Note: The CIM functionality is currently under development. Please do not use in production environments.

 

This article is an overview of how to use the MSIXMGR tool and its usage in MSIX app attach. MSIXMGR takes an MSIX packaged application (.MSIX) and expands it into an MSIX image (VHD or VHDX). That resulting MSIX image (.VHD(x)) is what we upload to a storage account using WVD MSIX app attach.

 

Prerequisites

To successfully complete the steps in this article please confirm the following steps:

  • Download MSIXMGR from https://aka.ms/msixmgr
  • MSIX packaged application (.MSIX file)
  • Administrative permissions on the machine where the MSIX image will be created.

Note: MSIXMGR can also create CIM files but those can only be used on Windows 10 20H2. This is something we are working to address.

 

Creating MSIX image

Expansion is the process of taking an MSIX packaged application (.MSIX) and unzipping it into an MSIX image (.VHD(x) or .CIM file).

 

These are the steps to perform expansion:

  • Download MSIXMGR from https://aka.ms/msixmgr
  • Unzip MSIXMGR.zip into a local folder
  • Open Command prompt (CMD) in elevated mode
  • Navigate to the local folder from the second step
  • Run the command below to generate an MSIX image

msixmgr.exe -Unpack -packagePath <path to package> -destination <output folder> [-applyacls] [-create] [-vhdSize <size in MB>] [-filetype <CIM | VHD | VHDX>] [-rootDirectory <rootDirectory>]

For example,

msixmgr.exe -Unpack -packagePath "C:\Users\ssa\Desktop\FileZillaChanged_3.51.1.0_x64__81q6ced8g4aa0.msix" -destination "c:\temp\FileZillaChanged.vhdx" -applyacls -create -vhdSize 200 -filetype "vhdx" -rootDirectory apps

 

  • Navigate to the destination folder and confirm that an MSIX image (.VHDX) was created

 

Note: The same command can be used to generate CIM and VHD by replacing the filetype and destination path.

 

CIM example

msixmgr.exe -Unpack -packagePath "C:\Users\ssa\Desktop\FileZillaChanged_3.51.1.0_x64__81q6ced8g4aa0.msix" -destination "c:\temp\FileZillaChanged.cim" -applyacls -create -vhdSize 200 -filetype "cim" -rootDirectory apps

 

VHDX example

msixmgr.exe -Unpack -packagePath "C:\Users\ssa\Desktop\FileZillaChanged_3.51.1.0_x64__81q6ced8g4aa0.msix" -destination "c:\temp\FileZillaChanged.vhdx" -applyacls -create -vhdSize 200 -filetype "vhdx" -rootDirectory apps

 

 

 

 

 

 

 

7 Replies

@Stefan Georgiev Please provide support or example of using PowerShell. My quick dirty test failed, no error, just a GUID folder in the msixmgr\x64 path. I want to loop through all my MSIX pacakges.

 

Clear-Host

$MSIXMGR = "C:\msixmgr\x64"
$MSIXPath = "C:\MSIX1"
$CimFS = "C:\CimFS"

$PackageName = "NotepadPlusPlus_7.9.1.0_x64"

If (!(Test-Path -Path $CimFS\$PackageName)) {New-Item -ItemType directory -Path $CimFS\$PackageName | Out-Null}

CD $MSIXMGR
.\msixmgr.exe -Unpack -packagePath "$MSIXPath\$PackageName.msix" -destination "$CimFS\$PackageName\$PackageName.cim" -applyacls -create -vhdSize 200 -filetype "cim" -rootDirectory apps

I pretty much ran your script with my variables and worked as expected. I started my PowerShell in admin mode that is required since MSIXMGR needs to manipulate drive.

$MSIXMGR = "C:\Users\ssa\Downloads\msixmgr\x64"
$MSIXPath = "C:\Users\ssa\Desktop\"
$CimFS = "C:\temp\date"

$PackageName = "GPUZ_1.0.1.0_x64__74vyvr5aw93s6"

If (!(Test-Path -Path $CimFS\$PackageName)) {New-Item -ItemType directory -Path $CimFS\$PackageName | Out-Null }

CD $MSIXMGR
.\msixmgr.exe -Unpack -packagePath "$MSIXPath\$PackageName.msix" -destination "$CimFS\$PackageName\$PackageName.cim" -applyacls -create -vhdSize 200 -filetype "cim" -rootDirectory apps
I could see the same situation. Maybe it is due to the MSIX package? Certain packages can be created as CIM without problems.
Is vhdSize required when creating a CIM as shown in the example above? When looking at the msixmgr.exe, vhdSize is only used for VHD and VHDX. I am trying to convert packages to CIM and they all fail with 80070058. I tried leaving vhdSize off the commandline but I receive the same message. Trying to figure out the proper commandline. I also read their might be an issue with msixmgr that has to do with file/folder length. Is this true?
I'm having the same problem, seems like a bug and hopefully will be fixed soon.
Is this possibly related to (https://github.com/microsoft/msix-packaging/issues/437) ? This is the error I get when attempting to package a sample app (azure data studio). The issue is the same even when files are in a very shallow path (c:\a)
This has been fixed