How to Automate MSIX Package Validation with MSIX Tweaker?
Sometimes, we have a package folder in our MSIX, containing files that are not part of the redirected locations list. Since all the folders need to be part of the known-VFS list, we need to use a fixup to copy those files from the WindowsApps folder (after the MSIX is installed) to the location you want.
In this article, we will cover how to easily find which MSIX packages from your repository contain files that need to be installed in ProgramFiles\WindowsApps folders, because those files are not accessible by default.
But, what if you have a 100 packages or more? How do you know which of them have this problem and which don’t? This is where the MSIX Tweaker, built by the Advanced Installer, can help you.
MSIX Tweaker is a free CLI tool developed by Advanced Installer to help you automate complex or repetitive MSIX post-processing tasks. Free download and details here.
How to Automate MSIX Package Validation?
The MSIX Tweaker automates complex and repetitive MSIX post-processing tasks like:
- Automate the digital signing of MSIX packages;
- Get full access to the package manifest, using XSLT;
- Predefined commands for common operations.
To automate MSIX Package Validation, we will use the MSIX Tweaker to scan and analyze a set of MSIX packages to understand their internal folder structure. This operation will quickly identify which packages require a fixup.
During our internal tests, we discovered that over 60% of MSIX packages created with MSIX Packaging Tool have file redirection issues. We analyzed around 200 packages, starting with the most used enterprise applications, including the packages we’ve tested for MSIX Ready and the submissions we have received on gomsix.com.
![MSIX Packages build with MSIX Packaging Tool MSIX Packaging Tool incomplete packages](png/msix-redirection-required.png)
One way to find out if an MSIX package has this problem is to open it with an MSIX editor tool (like Advanced Installer or the MSIX Packaging Tool), then inspect the list of folders included in the package. However, this practice is error prone and very time consuming.
The automated solution to find out which packages from your repository are not going to work as expected due to missing file redirections, is to use the MSIX Tweaker, as shown in the video below (time: 13:33).
Here is the script sample I used to scan my set of MSIX packages. Just update it with the paths of your repository and location of MSIX Tweaker on your machine and it’s ready to go.
Depending on the size of your packages and the power of your machine this script can run in 20 minutes or 20 hours. For best performance I recommend you copy the packages locally on your machines, instead of scanning them from a network location. Each package must be temporarily extracted and analyzed, and this operation is much slower when done over the network.
<# Return code is different from 0 if the package contains resources in folders outside of the list of known-folders list #> <# advancedinstaller.com/vfs-files-management #> $msixPackagesFolder = "I:\Downloads\msix-demo"; $invalidPackages = [System.Collections.ArrayList]@(); Get-ChildItem –Path $msixPackagesFolder -Recurse -Filter *.msix | Foreach-Object { .\MSIXTweaker.exe /ValidateVFS $_.FullName -nologo; if (! $?) {[void]$invalidPackages.Add($_.FullName);} } <# print the list of invalid packages#> if ($invalidPackages.count -gt 0) { Write-Host("`n You've got " + $invalidPackages.count + " MSIX packages with resources outside the known list of virtualized folders. `n More details about the known-folders list here:") -ForegroundColor DarkGreen -NoNewLine; Write-Host(" https://www.advancedinstaller.com/vfs-files-management.html `n") -ForegroundColor Yellow;} $invalidPackages Write-Host("`n");
Conclusion
Now you can save time by using the MSIX Tweaker to audit your packages and see which one needs a file redirection fixups.
We hope you found this article helpful and if you do have any ideas or suggestions, send them to us at support at advanced installer dot com.
Subscribe to Our Newsletter
Sign up for free and be the first to receive the latest news, videos, exclusive How-Tos, and guides from Advanced Installer.