You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: This topic describes the project properties that you can set in your Visual Studio project file to customize how your app is deployed.
2
+
title: Project properties and auto-initializers
3
+
description: Describes the project properties that you can set in your Visual Studio project file to customize how your app is deployed, including configuring auto-initializers.
4
4
ms.topic: article
5
-
ms.date: 11/17/2022
5
+
ms.date: 08/29/2025
6
6
ms.localizationpriority: medium
7
7
---
8
8
9
-
# Project properties
9
+
# Project properties and auto-initializers
10
10
11
-
This topic describes the project properties that you can set in your Visual Studio project file to customize how your app is deployed.
11
+
This topic describes the project properties that you can set in your Visual Studio project file (such as `.csproj` or `.vcxproj`) in order to customize how your app is deployed, including configuring auto-initializers.
12
+
13
+
## Auto-initializers in the Windows App SDK
14
+
15
+
In the Windows App SDK, there are several routines whose job it is to ensure that the Windows App Runtime is properly initialized. These routines are known as auto-initializers, because they run automatically before your application's entry point, and do initialization work for you.
16
+
17
+
> [!TIP]
18
+
> In case you're curious about technical details. In C++, an auto-initializer is implemented with a static class constructor. In C#, an auto-initializer is implemented with a .NET module initializer. So you might sometimes hear *module initializer* used when the proper term is *auto-initializer*.
19
+
20
+
All of the auto-initializers are conditionally enabled by default, based on your app's packaging and deployment configuration. Here are details about them:
21
+
22
+
* Bootstrapper (also known as dynamic dependencies) auto-initializer. This auto-initializer calls the bootstrapper API automatically at app startup. It's required for framework-dependent unpackaged apps, in order to ensure that the Windows App Runtime is added to the app's package graph. For info about framework-dependent (and self-contained) apps, see [Windows App SDK deployment overview](/windows/apps/package-and-deploy/deploy-overview). For info about unpackaged (and packaged) apps, see [Windows apps: packaging, deployment, and process](/windows/apps/get-started/intro-pack-dep-proc).
23
+
* For a packaged app, you don't need the bootstrapper/dynamic dependencies auto-initializer because the `appxmanifest.xml` file expresses the framework dependency. And for a self-contained app, you don't need the bootstrapper/dynamic dependencies auto-initializer because those apps don't use the framework.
24
+
* You can opt out of the bootstrapper/dynamic dependencies auto-initializer in your `.csproj` or `.vcxproj` file via `<WindowsAppSdkBootstrapInitialize>false</WindowsAppSdkBootstrapInitialize>`.
25
+
* Deployment Manager auto-initializer. This is required for framework-dependent packaged apps that make use of main/singleton functionality (for example, push notifications), because the `appxmanifest.xml` file can't express those dependencies.
26
+
* For a self-contained app, you don't need the Deployment Manager auto-initializer because those apps don't support main/singleton functionality.
27
+
* Registration-free activation auto-initializer. This is required for a self-contained app to use manifest-based undocked registration-free Windows Runtime (WinRT) activation (*UndockedRegFreeWinRT*), if the app is running downlevel on an operating system version earlier than Windows 10 May 2019 Update (version 1903; codenamed "19H1").
28
+
* For framework-dependent apps, and for self-contained apps that target Windows 10, version 1903, or later, you don't need the registration-free activation auto-initializer. Those apps can opt out via `<WindowsAppSdkUndockedRegFreeWinRTInitialize>false</WindowsAppSdkUndockedRegFreeWinRTInitialize>`.
29
+
* Compatibility auto-initializer. This is required for an app to use A/B containment facilities to control servicing release behavior. For more info, see [RuntimeCompatibilityOptions](/windows/windows-app-sdk/api/winrt/microsoft.windows.applicationmodel.windowsappruntime.runtimecompatibilityoptions).
30
+
* For apps that don't use A/B containment (which is the default), you don't need the compatibility auto-initializer.
31
+
32
+
## Project properties
33
+
34
+
These are the properties you can set You can use your app's project file to specify the patch level and disabled changes. Here's an example of how to specify the patch level and disabled changes in your project file :
35
+
36
+
See the previous section (above) for details about the auto-initializers in the Windows App SDK.
12
37
13
38
|Property name and description|Values|For more info|
14
39
|-|-|-|
15
40
|**AppxPackage**. Specifies whether or not a WinUI 3 app is packaged.|*false* (for an unpackaged app), or absent (for a packaged app)|[Create a new project for an unpackaged WinUI 3 desktop app](/windows/apps/winui/winui3/create-your-first-winui3-app#unpackaged-create-a-new-project-for-an-unpackaged-c-or-c-winui-3-desktop-app)|
16
41
|**EnableMsixTooling**. Enables the single-project MSIX feature for a project.|*true* (to enable), or absent (to disable)|[Package your app using single-project MSIX](/windows/apps/windows-app-sdk/single-project-msix)|
17
42
|**UseWinUI**. Specifies whether you're using the WinUI 3 user interface framework in your app.|*true*, or absent (for *false*)|[WinUI in the Windows App SDK (WinUI 3)](/windows/apps/winui/winui3/)|
18
-
|**WindowsAppSdkBootstrapInitialize**. Determines whether or not the Windows App SDK leverages module initializers to call the bootstrapper API automatically at app startup.|*true* (the default for executables), *false* (the default for non-executables)|[Opting out of (or into) automatic module initialization](/windows/apps/windows-app-sdk/use-windows-app-sdk-run-time#opting-out-of-or-into-automatic-module-initialization)|
43
+
|**WindowsAppSdkBootstrapInitialize**. Determines whether or not the Windows App SDK leverages the bootstrapper/dynamic dependencies auto-initializer.|*true* (the default for executables), *false* (the default for non-executables)|[Opting out of (or into) auto-initializers](/windows/apps/windows-app-sdk/use-windows-app-sdk-run-time#opting-out-of-or-into-automatic-module-initialization)|
19
44
|**WindowsAppSdkSelfContained**. Determines whether or not an app is deployed *self-contained*.|*true*, or absent (for *false*)|[Windows App SDK deployment guide for self-contained apps](/windows/apps/package-and-deploy/self-contained-deploy/deploy-self-contained-apps)|
20
-
|**WindowsAppSdkUndockedRegFreeWinRTInitialize**. Determines whether or not the Windows App SDK's implementation of undocked registration-free Windows Runtime (*UndockedRegFreeWinRT*) is enabled automatically at app startup.|*true* (the default for executables), *false* (the default for non-executables)|[Opting out of (or into) automatic UndockedRegFreeWinRT support](/windows/apps/package-and-deploy/self-contained-deploy/deploy-self-contained-apps#opting-out-of-or-into-automatic-undockedregfreewinrt-support)|
21
-
|**WindowsPackageType**. Setting `<WindowsPackageType>None</WindowsPackageType>` for an unpackaged app causes the *auto-initializer* to locate and load a version of the Windows App SDK version that's most appropriate for your app.|*None*, or absent (to disable the auto-initializer)|[Create a new project for an unpackaged WinUI 3 desktop app](/windows/apps/winui/winui3/create-your-first-winui3-app#unpackaged-create-a-new-project-for-an-unpackaged-c-or-c-winui-3-desktop-app)<br/><br/>[Behind the scenes, and opting out of automatic module initialization](/windows/apps/windows-app-sdk/use-windows-app-sdk-run-time#behind-the-scenes-and-opting-out-of-automatic-module-initialization)|
45
+
|**WindowsAppSdkUndockedRegFreeWinRTInitialize**. Determines whether or not the Windows App SDK leverages the Registration-free activation auto-initializer.|*true* (the default for executables), *false* (the default for non-executables)|[Opting out of (or into) automatic UndockedRegFreeWinRT support](/windows/apps/package-and-deploy/self-contained-deploy/deploy-self-contained-apps#opting-out-of-or-into-automatic-undockedregfreewinrt-support)|
46
+
|**WindowsPackageType**. Setting `<WindowsPackageType>None</WindowsPackageType>` for an unpackaged app causes the bootstrapper/dynamic dependencies auto-initializer to locate and load a version of the Windows App SDK version that's most appropriate for your app.|*None*, or absent (to disable the auto-initializer)|[Create a new project for an unpackaged WinUI 3 desktop app](/windows/apps/winui/winui3/create-your-first-winui3-app#unpackaged-create-a-new-project-for-an-unpackaged-c-or-c-winui-3-desktop-app)<br/><br/>[Behind the scenes, and opting out of auto-initializers](/windows/apps/windows-app-sdk/use-windows-app-sdk-run-time#behind-the-scenes-and-opting-out-of-automatic-module-initialization)|
47
+
|**WindowsAppSDKRuntimePatchLevel1**, **WindowsAppSDKRuntimePatchLevel2**, and **WindowsAppSDKDisabledChanges**. Determines whether or not the Windows App SDK leverages the compatibility auto-initializer, and configures any desired compatibility options for Windows App Runtime behavior of changes added in servicing updates.|Various, or absent (to disable the auto-initializer)|[RuntimeCompatibilityOptions](/windows/windows-app-sdk/api/winrt/microsoft.windows.applicationmodel.windowsappruntime.runtimecompatibilityoptions)|
22
48
23
49
## Example
24
50
25
-
Here's an excerpt from a typical `.csproj` file for a C# WinUI 3 project showing some of the project properties from the table above in use.
51
+
Here's an excerpt from a typical `.csproj` file for a C# WinUI 3 project, showing some of the project properties from the table above in use.
26
52
27
53
```xml
28
54
...
@@ -40,4 +66,12 @@ Here's an excerpt from a typical `.csproj` file for a C# WinUI 3 project showing
Copy file name to clipboardExpand all lines: hub/apps/windows-app-sdk/deployment-architecture.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,7 +67,7 @@ The bootstrapper is a library that must be included with your packaged with exte
67
67
- Initialize the Dynamic Dependency Lifetime Manager (DDLM) for the Windows App SDK framework package.
68
68
- Find and load the Windows App SDK framework package to the app's package graph.
69
69
70
-
To accomplish these tasks, the nuget package leverages module initializers to wire up the bootstrapper for you. Simply set `<WindowsPackageType>None</WindowsPackageType>` in your project file. In advanced scenarios, if you want control over the initialization, you can call the bootstrapper API directly in your app's startup code (see [Tutorial: Use the bootstrapper API in an app packaged with external location or unpackaged that uses the Windows App SDK](tutorial-unpackaged-deployment.md)) so that it can properly initialize the system for the unpackaged app. Your app must use the bootstrapper API before it can use Windows App SDK features such as WinUI, App lifecycle, MRT Core, and DWriteCore.
70
+
To accomplish these tasks, the nuget package leverages [auto-initializers](/windows/apps/package-and-deploy/project-properties#auto-initializers-in-the-windows-app-sdk) to wire up the bootstrapper for you. Simply set `<WindowsPackageType>None</WindowsPackageType>` in your project file. In advanced scenarios, if you want control over the initialization, you can call the bootstrapper API directly in your app's startup code (see [Tutorial: Use the bootstrapper API in an app packaged with external location or unpackaged that uses the Windows App SDK](tutorial-unpackaged-deployment.md)) so that it can properly initialize the system for the unpackaged app. Your app must use the bootstrapper API before it can use Windows App SDK features such as WinUI, App lifecycle, MRT Core, and DWriteCore.
71
71
72
72
The bootstrapper library in the Windows App SDK 1.0 release includes:
Copy file name to clipboardExpand all lines: hub/apps/windows-app-sdk/use-windows-app-sdk-run-time.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Use the Windows App SDK runtime for apps packaged with external location or unpackaged
3
3
description: If your app isn't installed by using MSIX (that is, it's packaged with external location or unpackaged), then you must initialize the Windows App SDK for use before you can call Windows App SDK features such as WinUI 3, App Lifecycle, MRT Core, and DWriteCore.
4
4
ms.topic: article
5
-
ms.date: 07/14/2025
5
+
ms.date: 08/29/2025
6
6
ms.localizationpriority: medium
7
7
---
8
8
@@ -20,9 +20,9 @@ Either of the two techniques above allows an app that doesn't use MSIX to take a
20
20
21
21
For background information about dynamic dependencies, see [MSIX framework packages and dynamic dependencies](../desktop/modernize/framework-packages/framework-packages-overview.md).
22
22
23
-
## Behind the scenes, and opting out of automatic module initialization
23
+
## Behind the scenes, and opting out of auto-initializers
24
24
25
-
The code generated by the `WindowsPackageType` property mentioned above leverages module initializers to call the bootstrapper API. The bootstrapper does the heavy lifting to find the Windows App SDK and enable the current process to use it. The generated code handles both initialization and shutdown. You can control initialization's behavior with the following project properties:
25
+
The code generated by the `WindowsPackageType` property mentioned above leverages [auto-initializers](/windows/apps/package-and-deploy/project-properties#auto-initializers-in-the-windows-app-sdk) to call the bootstrapper API. The bootstrapper does the heavy lifting to find the Windows App SDK and enable the current process to use it. The generated code handles both initialization and shutdown. You can control initialization's behavior with the following project properties:
@@ -46,11 +46,11 @@ If you want your app to have explicit control, then you can directly call the bo
46
46
> [!NOTE]
47
47
> In addition to the automatic initialization and the bootstrapper API, the Windows App SDK also provides an implementation of the *dynamic dependency API*. This API enables your unpackaged apps to take a dependency on *any* framework package (not just the Windows App SDK framework package), and it is used internally by the bootstrapper API. For more information about the dynamic dependency API, see [Use the dynamic dependency API to reference MSIX packages at run time](../desktop/modernize/framework-packages/use-the-dynamic-dependency-api.md).
48
48
49
-
### Opting out of (or into) automatic module initialization
49
+
### Opting out of (or into) auto-initializers
50
50
51
-
The project property `<WindowsAppSdkBootstrapInitialize>false</WindowsAppSdkBootstrapInitialize>` disables the automatic module initialization described above (the bootstrapper API isn't called). That allows your app to take responsibility and directly call the bootstrapper API.
51
+
The project property `<WindowsAppSdkBootstrapInitialize>false</WindowsAppSdkBootstrapInitialize>` disables the auto-initializer described above (the bootstrapper API isn't called). That allows your app to take responsibility, and directly call the bootstrapper API.
52
52
53
-
As of version 1.2 of the Windows App SDK (from the stable channel), automatic module initialization applies only to projects that produce an executable (that is, the **OutputType** project property is set to *Exe* or *WinExe*). This is to prevent adding auto-initializers into class library DLLs and other non-executables by default. If you *do* need an auto-initializer in a non-executable (for example, a test DLL loaded by a host process executable that doesn't initialize the bootstrapper), then you can explicitly enable an auto-initializer in your project with `<WindowsAppSdkBootstrapInitialize>true</WindowsAppSdkBootstrapInitialize>`.
53
+
As of version 1.2 of the Windows App SDK (from the stable channel), auto-initializers apply only to projects that produce an executable (that is, the **OutputType** project property is set to *Exe* or *WinExe*). That's to prevent adding auto-initializers into class library DLLs and other non-executables by default. If you *do* need an auto-initializer in a non-executable (for example, a test DLL loaded by a host process executable that doesn't initialize the bootstrapper), then you can explicitly enable an auto-initializer in your project with `<WindowsAppSdkBootstrapInitialize>true</WindowsAppSdkBootstrapInitialize>`.
0 commit comments