Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
msixbundle-rs
A Rust library and CLI tool for building and signing Windows MSIX packages and MSIX bundles using the Windows SDK toolchain (MakeAppx and SignTool).
Overview
msixbundle-rs provides a programmatic Rust interface to automate the creation, signing, and validation of multi-architecture MSIX packages and bundles. It's designed for build pipelines that need to package Windows applications for distribution via the Microsoft Store or enterprise deployment.
Features
- Multi-architecture support: Build separate MSIX packages for x64 and ARM64 architectures
- Automatic bundle creation: Combine per-architecture packages into a single
.msixbundle - SDK auto-discovery: Automatically locate Windows SDK tools (
MakeAppx.exe,signtool.exe,appcert.exe) via registry - Code signing: Sign packages and bundles with PFX certificates
- Timestamping: Support for both RFC3161 and Authenticode timestamp protocols
- Validation: Validate packages using Windows App Certification Kit (WACK) and verify signatures
- Manifest parsing: Extract version and display name from
AppxManifest.xml - Library and CLI: Use as a Rust library or standalone command-line tool
Components
Library: msixbundle
The core library providing the building blocks for MSIX packaging operations.
Key APIs:
locate_sdk_tools()- Find Windows SDK tools on the systemread_manifest_info()- Parse AppxManifest.xml for version and identitypack_arch()- Create a per-architecture .msix packagebuild_bundle()- Combine multiple .msix files into a .msixbundlesign_artifact()- Sign packages/bundles with a PFX certificateverify_signature()- Verify digital signaturesvalidate_package()- Validate packages using WACK (Windows App Certification Kit)
CLI: msixbundle-cli
Command-line interface for packaging workflows.
Installation
As a CLI tool
As a library
Add to your Cargo.toml:
[]
= "0.1.0"
Usage
CLI Tool
Basic usage - build a bundle from x64 and ARM64 app directories:
Build and sign with a PFX certificate:
Sign individual architecture packages before bundling:
With validation and verification:
CLI Options
| Option | Description |
|---|---|
--out-dir |
Output directory for generated .msix and .msixbundle files |
--dir-x64 |
Path to x64 AppxContent directory containing AppxManifest.xml |
--dir-arm64 |
Path to ARM64 AppxContent directory |
--pfx |
Path to PFX certificate file for signing |
--pfx-password |
Password for the PFX certificate |
--sign-each |
Sign individual architecture packages (not just the bundle) |
--signtool-path |
Override path to signtool.exe |
--sip-dll |
Path to Appx SIP DLL (e.g., C:\Windows\System32\AppxSip.dll) |
--timestamp-url |
Timestamp server URL (default: http://timestamp.digicert.com) |
--timestamp-mode |
Timestamping protocol: rfc3161 or authenticode (default: rfc3161) |
--validate |
Validate packages using WACK (Windows App Certification Kit) |
--verify |
Verify signatures with SignTool after signing |
--verbose |
Enable verbose logging (sets RUST_LOG=info) |
Library API
use *;
use Path;
Requirements
- Windows OS: This tool requires Windows and the Windows SDK
- Windows SDK 10: MakeAppx.exe and signtool.exe must be installed
- Install via Visual Studio or standalone SDK
- Windows App Certification Kit (WACK): Required for
--validateflag (appcert.exe)- Installed automatically with the Windows SDK
- Note: WACK validation may require administrator privileges on some systems
- Rust: 1.70+ (2021 edition)
The library can automatically discover SDK tools via the Windows registry, or you can provide explicit paths.
How It Works
- Manifest Parsing: Reads
AppxManifest.xmlfrom each architecture directory to extract version and identity information - Package Creation: Uses
MakeAppx.exeto create.msixfiles for each architecture from the AppxContent directories - Bundle Mapping: Generates a
bundlemap.txtfile listing all architecture packages - Bundle Creation: Uses
MakeAppx.exeto combine packages into a.msixbundle - Signing: Uses
signtool.exeto apply digital signatures with optional timestamping - Validation: Optionally validates packages with WACK and verifies signature validity
Creating a Self-Signed Certificate for Testing
For development and testing, you can create a self-signed certificate. Note: Self-signed certificates are only for local testing. Microsoft Store submissions do not require pre-signing as the Store handles signing automatically.
Important: Certificate Subject Must Match Manifest Publisher
The certificate's Common Name (CN) must exactly match the Publisher attribute in your AppxManifest.xml:
If your manifest has Publisher="CN=YourCompany", your certificate must also have CN=YourCompany.
Using PowerShell (Recommended on Windows)
# Replace "CN=YourCompany" with the Publisher value from your AppxManifest.xml
$cert = New-SelfSignedCertificate -Type Custom -Subject "CN=YourCompany" `
-KeyUsage DigitalSignature -FriendlyName "MSIX Test Certificate" `
-CertStoreLocation "Cert:\CurrentUser\My" `
-TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.3", "2.5.29.19={text}")
# Export to PFX file
$password = ConvertTo-SecureString -String "YourPassword" -Force -AsPlainText
Export-PfxCertificate -Cert $cert -FilePath ".\test-certificate.pfx" -Password $password
# Install to Trusted Root (required for local testing/installation)
$store = New-Object System.Security.Cryptography.X509Certificates.X509Store("Root", "LocalMachine")
$store.Open("ReadWrite")
$store.Add($cert)
$store.Close()
Using OpenSSL
# Replace "CN=YourCompany" with the Publisher value from your AppxManifest.xml
# Generate a private key
# Create a certificate signing request
# Generate a self-signed certificate
# Export to PFX format
Installing the Certificate for Testing
To install MSIX packages signed with a self-signed certificate on your local machine, the certificate must be in the Trusted Root Certification Authorities store:
Using PowerShell (as Administrator):
Import-PfxCertificate -FilePath ".\test-certificate.pfx" -CertStoreLocation Cert:\LocalMachine\Root -Password (ConvertTo-SecureString -String "YourPassword" -Force -AsPlainText)
Using Certificate Manager (certmgr.msc):
- Run
certmgr.mscas Administrator - Right-click Trusted Root Certification Authorities → All Tasks → Import
- Select your
.pfxfile and complete the wizard
Important Notes
- Microsoft Store: No certificate needed - submit unsigned packages, the Store signs them
- Enterprise/Sideloading: Use a certificate from a trusted Certificate Authority
- Local Testing: Self-signed certificates work after installing to Trusted Root
- Self-signed certificates will cause security warnings on other machines unless installed there too
- Remove test certificates from Trusted Root after testing for security
Using with msixbundle-cli
Once you have a PFX certificate with matching CN, use it with the tool:
Project Structure
msixbundle-rs/
├── msixbundle/ # Core library
│ ├── src/
│ │ └── lib.rs # Main library implementation
│ └── Cargo.toml
├── msixbundle-cli/ # Command-line tool
│ ├── src/
│ │ └── main.rs # CLI implementation
│ └── Cargo.toml
└── Cargo.toml # Workspace configuration
Error Handling
The library uses anyhow::Result for error handling and provides custom error types via MsixError:
ToolMissing: Windows SDK tool not foundMakeAppx: MakeAppx.exe operation failedSignTool: signtool.exe operation failedManifest: Manifest parsing errorValidation: WACK validation failed
Features
SDK Discovery
Enabled by default. Automatically locates Windows SDK tools via registry.
[]
= { = "0.1.0", = true }
To disable auto-discovery and provide paths manually:
[]
= { = "0.1.0", = false }
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
License
MIT License - see the LICENSE file for details.
Resources
- MSIX Documentation
- MakeAppx.exe Tool Reference
- SignTool.exe Documentation
- Windows App Certification Kit (WACK)
- AppxManifest Schema