Skip to content

Latest commit

 

History

History
51 lines (34 loc) · 1.47 KB

File metadata and controls

51 lines (34 loc) · 1.47 KB

C++ Sample Application

This sample demonstrates how to use winapp CLI with a C++ application built with CMake to add package identity and package as MSIX.

For a complete step-by-step guide, see the C++ Getting Started Guide.

What This Sample Shows

  • Basic C++ console application built with CMake
  • Using Windows App Model APIs to retrieve package identity
  • Using winapp run to run the app packaged (registers a loose layout package, just like a real MSIX install)
  • MSIX packaging with app manifest and assets

Prerequisites

  • Visual Studio Native Desktop workload or Visual Studio with C++ development tools
  • CMake 3.20 or later
  • WinApp CLI installed

Building and Running

Restore dependencies

winapp restore

Build the Application

cmake -B build
cmake --build build --config Debug

Run without Identity

.\build\Debug\cpp-app.exe

Output should be: "Not packaged"

Run with Identity (Debug)

winapp run .\build\Debug --with-alias

This registers a loose layout package (just like a real MSIX install), then launches the app via its execution alias so console output stays in the current terminal.

Output should show the Package Family Name.

Note: The --with-alias flag requires a uap5:ExecutionAlias in the manifest. This sample's appxmanifest.xml already includes one. You can add one to an appxmanifest.xml with winapp manifest add-alias.