Skip to content

Repository files navigation

About

Use the digitalxero/go-msix library to create a MSIX package.

Develop

Install Chocolatey.

Install MSYS2 and Go:

choco install -y msys2 --params="'/NoPath'"
choco install -y go

Execute the following commands in a MSYS2 bash session.

Install the dependencies:

winget install --exact --id MichalTrojnara.osslsigncode

To use the updated PATH environment variable, which will now include the newly installed applications, exit the shell session, and open a new one.

Build the application, the example code signing certificate, and the MSIX:

go generate ./...
CGO_ENABLED=0 GOAMD64=v3 go build -trimpath -ldflags "-s -w"
./create-example-code-signing-certificate.sh
./use-go-msix.exe build-msix

Install the unsigned MSIX, show information about it, execute it, and finally uninstall it:

unzip -l use-go-msix-unsigned.msix
unzip -p use-go-msix-unsigned.msix AppxManifest.xml
pwsh -Command 'Add-AppxPackage use-go-msix-unsigned.msix -AllowUnsigned'
pwsh -Command 'Get-AppxPackage -Name UseGoMsix'
pwsh -Command '&"$((Get-AppxPackage -Name UseGoMsix).InstallLocation)\use-go-msix.exe"'
pwsh -Command 'Start-Process "shell:AppsFolder\$((Get-AppxPackage -Name UseGoMsix).PackageFamilyName)!App"'
pwsh -Command 'Get-AppxPackage -Name UseGoMsix | Remove-AppxPackage'

Install the signed MSIX, show information about it, execute it, and finally uninstall it:

NB The signature verification will fail when your host does not trust the example-code-signing CA.

unzip -l use-go-msix.msix
unzip -p use-go-msix.msix AppxManifest.xml
osslsigncode verify -in use-go-msix.msix -CAfile example-code-signing-ca-crt.pem
pwsh -Command 'Import-Certificate example-code-signing-ca-crt.pem -CertStoreLocation Cert:/LocalMachine/Root'
pwsh -Command 'Get-AuthenticodeSignature use-go-msix.msix | Format-List'
pwsh -Command 'Add-AppxPackage use-go-msix.msix'
pwsh -Command 'Get-AppxPackage -Name UseGoMsix'
pwsh -Command '&"$((Get-AppxPackage -Name UseGoMsix).InstallLocation)\use-go-msix.exe"'
pwsh -Command 'Start-Process "shell:AppsFolder\$((Get-AppxPackage -Name UseGoMsix).PackageFamilyName)!App"'
pwsh -Command 'Get-AppxPackage -Name UseGoMsix | Remove-AppxPackage'
pwsh -Command 'Remove-Item -Path "Cert:/LocalMachine/Root/$(([System.Security.Cryptography.X509Certificates.X509Certificate2]::new([System.IO.File]::ReadAllBytes("example-code-signing-ca-crt.pem"))).Thumbprint)"'

References

About

Use the digitalxero/go-msix library to create a MSIX package.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages