This is a framework-dependent variant of the WindowsML C++ console desktop sample that uses shared helpers.
- Deployment: Framework-dependent (
WindowsAppSDKSelfContained=false) - Package Dependencies: Uses both ML and Runtime packages for framework-dependent deployment
- Shared Helpers: Uses the same shared helper classes from
../../Shared/cpp/ - Source Files: References the main application source from
../CppConsoleDesktop/CppConsoleDesktop.cpp - Runtime Dependencies: Requires WindowsAppSDK Runtime to be installed on target machine
- Framework-dependent deployment with smaller application footprint
- Relies on WindowsAppSDK Runtime package installed on target machine
- Shared runtime components reduce deployment size
- Follows the recommended deployment pattern for WindowsAppSDK applications
- Microsoft.WindowsAppSDK.ML
- Microsoft.WindowsAppSDK.Runtime
- Microsoft.WindowsAppSDK.Base
- Microsoft.WindowsAppSDK.Foundation
- Microsoft.WindowsAppSDK.InteractiveExperiences
- Microsoft.Windows.CppWinRT
- Microsoft.Windows.SDK.BuildTools
- Microsoft.Windows.SDK.BuildTools.MSIX
See packages.config for current package versions.
Framework-dependent applications require bootstrap initialization to properly discover and initialize the Windows App SDK runtime at startup. This project is configured to automatically include the necessary bootstrap code.
-
Foundation Package: The
Microsoft.WindowsAppSDK.Foundationpackage provides bootstrap functionality for framework-dependent deployments. -
InteractiveExperiences Dependency: Foundation package depends on
Microsoft.WindowsAppSDK.InteractiveExperienceswhich provides essential UI metadata (likeMicrosoft.UI.WindowId) required by CppWinRT projections. -
Bootstrap Property: The project sets
<WindowsAppSdkBootstrapInitialize>true</WindowsAppSdkBootstrapInitialize>before importing any Windows App SDK packages. -
Auto-Generated Code: When the property is set correctly, the Foundation package automatically includes
MddBootstrapAutoInitializer.cppin the build, which handles runtime discovery and initialization.
- The
WindowsAppSdkBootstrapInitializeproperty must be defined before importing Windows App SDK packages - The Foundation package
.propsand.targetsfiles must be imported in the correct order - The InteractiveExperiences package is required as a dependency of Foundation
- Framework-dependent projects (
WindowsAppSDKSelfContained=false) require this bootstrap mechanism
If setting up a new framework-dependent project:
-
Add the required packages to
packages.config:<package id="Microsoft.WindowsAppSDK.Foundation" version="[version]" targetFramework="native" /> <package id="Microsoft.WindowsAppSDK.InteractiveExperiences" version="[version]" targetFramework="native" /> <package id="Microsoft.WindowsAppSDK.Runtime" version="[version]" targetFramework="native" /> <package id="Microsoft.WindowsAppSDK.Base" version="[version]" targetFramework="native" />
-
Set the bootstrap property at the top of your
.vcxprojfile (before any imports):<PropertyGroup> <WindowsAppSdkBootstrapInitialize>true</WindowsAppSdkBootstrapInitialize> </PropertyGroup>
-
Import Foundation and InteractiveExperiences package build files:
<!-- In props section --> <Import Project="packages\Microsoft.WindowsAppSDK.Foundation.[version]\build\native\Microsoft.WindowsAppSDK.Foundation.props" /> <Import Project="packages\Microsoft.WindowsAppSDK.InteractiveExperiences.[version]\build\native\Microsoft.WindowsAppSDK.InteractiveExperiences.props" /> <!-- In targets section --> <Import Project="packages\Microsoft.WindowsAppSDK.Foundation.[version]\build\native\Microsoft.WindowsAppSDK.Foundation.targets" /> <Import Project="packages\Microsoft.WindowsAppSDK.InteractiveExperiences.[version]\build\native\Microsoft.WindowsAppSDK.InteractiveExperiences.targets" />
-
CppWinRT Error: "Microsoft.UI.WindowId could not be found"
- Solution: Ensure the InteractiveExperiences package is included. Foundation depends on UI metadata provided by this package.
-
Bootstrap initialization not working
- Solution: Verify the
WindowsAppSdkBootstrapInitializeproperty is set totruebefore any package imports in the vcxproj file.
- Solution: Verify the
-
Duplicate file warnings during build
- Note: Multiple packages may include the same auto-initializer files. The linker will automatically ignore duplicates - these warnings are informational only.
This configuration ensures the Windows App SDK runtime is properly initialized when your application starts, even when the runtime is not packaged with your application.
The target machine must have the Windows App SDK Runtime installed. This is the recommended deployment model for most applications as it allows for shared runtime components and easier servicing.