Guide

Build your own fix

A “fix” in MSIXForcelets is just a function that opens an MSIX package, applies a handful of framework cmdlets and repacks it. The built-in fixes (Add-MSIXFixWinRAR, Add-MSIXFixNotepadPlusPlus …) all follow the same shape — here is how to write your own.

1. The anatomy of a fix

Every fix is an advanced function named Add-MSIXFix<App> with a consistent parameter block. It opens the package, does its work, then repacks — all inside a try/catch.

function Add-MSIXFixMyApp {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory, ValueFromPipeline, Position=0)]
        [System.IO.FileInfo] $MsixFile,

        [System.IO.DirectoryInfo] $MSIXFolder = ($env:Temp + '\MSIX_' + [guid]::NewGuid()),
        [System.IO.FileInfo] $OutputFilePath = $null,
        [string] $Subject = '',
        [switch] $Force,
        [switch] $KeepMSIXFolder
    )
    process {
        if (-not $OutputFilePath) { $OutputFilePath = $MsixFile }
        try {
            Open-MSIXPackage -MsixFile $MsixFile -MSIXFolder $MSIXFolder -Force:$Force
            if ($Subject) { Set-MSIXPublisher -MSIXFolder $MSIXFolder -PublisherSubject $Subject }

            # --- your building blocks go here (see step 2) ---

            Close-MSIXPackage -MSIXFolder $MSIXFolder -MSIXFile $OutputFilePath `
                -Force:$Force -KeepMSIXFolder:$KeepMSIXFolder
        }
        catch { Write-Error "Error applying MyApp fix: $_" }
    }
}

2. Pick your building blocks

Drop in only what the app needs. Each links to its reference entry.

3. A worked example

A typical PSF-based fix — modelled on Add-MSIXFixWinRAR:

            # 1. clean captured leftovers
            Invoke-MSIXCleanup -MSIXFolder $MSIXFolder

            # 2. capabilities the app needs
            Add-MSIXCapabilities -MSIXFolder $MSIXFolder -Capabilities 'internetClient'

            # 3. let the loader find sibling DLLs
            Add-MSIXloaderSearchPathOverride -MSIXFolderPath $MSIXFolder -FolderPaths 'VFS\ProgramFilesX64\MyApp'
            Add-MSIXInstalledLocationVirtualization -MSIXFolderPath $MSIXFolder

            # 4. wire every application through the PSF launcher
            Add-MSIXPsfFrameworkFiles -MSIXFolder $MSIXFolder
            foreach ($app in (Get-MSIXApplications -MSIXFolder $MSIXFolder)) {
                Add-MSXIXPSFShim -MSIXFolder $MSIXFolder -MISXAppID $app.Id -PSFArchitektur x64
            }

            # 5. registry + file-redirection fixups
            Add-MSIXPSFDefaultRegLegacy -MSIXFolder $MSIXFolder
            Add-MSIXPSFMFRFixup -MSIXFolder $MSIXFolder -IlvAware $true

4. Test & diagnose

PSF cmdlets need an active framework. Run the fix, sign the result, install and inspect:

Set-MSIXActivePSFFramework -Framework TimManganPSF     # required for shims/fixups

Add-MSIXFixMyApp -MsixFile 'C:\Apps\MyApp.msix' `
    -OutputFilePath 'C:\Apps\MyApp_fixed.msix' -Verbose

$cert = New-MSIXSelfSigningCert -Subject 'CN=Test' -Password 'pw'
Set-MSIXSignature -MSIXFile 'C:\Apps\MyApp_fixed.msix' -PfxCert $cert

# when something hangs or fails to launch:
Wait-MSIXTracing     # ETW trace start/stop around a launch

Tip: run with -KeepMSIXFolder to inspect the expanded package, and pair the ETW trace with Process Monitor (filter Result = NAME NOT FOUND / ACCESS DENIED) to find what the app is missing.

5. Ship it — or contribute it back

Save the function as src/Public/Add-MSIXFixMyApp.ps1; the module auto-exports everything in Public/. Your .SYNOPSIS line automatically appears in the cmdlet reference. Got a fix for a common app? Open a pull request — the goal of this project is a growing library of ready-made solutions.

Browse the building blocks →