This sample demonstrates how to check for package identity and send Windows notifications from a Rust application.
Before running the sample, ensure you have Rust and the winappcli tool installed.
If you haven't installed Rust yet, you can download it from rust-lang.org or use winget:
winget install Rustlang.Rustup --source wingetInstall the winapp command line tool using winget:
winget install microsoft.winappcli --source wingetTo run the application as a standard executable without package identity:
- Build the project:
cargo build
- Run the executable:
Output should be: "Not packaged"
.\target\debug\rust-app.exe
To run the application with a temporary debug identity:
- Build the project:
cargo build
- Apply debug identity to the executable:
winapp create-debug-identity .\target\debug\rust-app.exe
- Run the executable:
Output should show the Package Family Name and trigger a notification.
.\target\debug\rust-app.exe
To fully package the application as an MSIX and install it:
-
Generate a Certificate: Create a self-signed certificate for signing based on the manifest.
winapp cert generate --manifest .\appxmanifest.xml -
Install the Certificate: Install the certificate locally (requires Admin privileges).
winapp cert install .\devcert.pfx
-
Build for Release:
cargo build --release -
Prepare Packaging Directory:
mkdir msix mv .\target\release\rust-app.exe .\msix\(Note: Move the exe and any other needed dependencies to this
msixfolder) -
Pack the Application:
winapp pack .\msix --manifest .\appxmanifest.xml --cert .\devcert.pfx
-
Install and Run:
- Double-click the generated
.msixfile to install. - Once installed, you can run it from the Start menu or by typing
winapp-rust-sample.exein your terminal.
- Double-click the generated