Microsoft Windows App SDK 1.0 Stable released, available to download (Release Notes)
12 min. read
Updated on
Read our disclosure page to find out how can you help MSPoweruser sustain the editorial team Read more
After several Preview builds, Microsoft has just released Windows App SDK 1.0.0 Stable, a toolkit that empowers desktop app developers to build apps with a modern Windows UI, APIs, and platform features.
In this release, Microsoft added multiple new features from Windows App SDK 0.8 and stabilized issues from 1.0 Preview releases.
[lwptoc title=”WindowsAppSDK 1.0 Stable” width=”30%” float=”right”]
WinUI 3
WinUI 3 is the native user experience (UX) framework for Windows App SDK.
New features and updates:
- Microsoft has added new controls (PipsPager, Expander, BreadcrumbBar) and updated existing controls to reflect the latest Windows styles from WinUI 2.6.
- Single-project MSIX packaging is supported in WinUI by creating a new application using the “Blank App, Packaged…” template.
- Microsoft now support deploying WinUI 3 apps without MSIX-packaging on Windows versions 1809 and above. Please view Create a WinUI 3 unpackaged desktop app for additional information.
- WinUI 3 projects can now set their target version down to Windows 10, version 1809. Previously, they could only be set as low as version 1903.
- In-app toolbar, Hot Reload, & Live Visual Tree for WinUI packaged apps are supported in Visual Studio 2022 Preview 5 and GA.
Important limitations:
- Known issues for both packaged and unpackaged WinUI applications:
- Run-time error in C++ apps that reference a C++ Windows Runtime Component: To resolve, add the below target to the end of the Windows Runtime Component’s .vcxproj:
XML
<Target Name="GetPriIndexName"> <PropertyGroup> <!-- Winmd library targets use the default root namespace of the project for the App package name --> <PriIndexName Condition="'$(RootNamespace)' != ''">$(RootNamespace)</PriIndexName> <!-- If RootNamespace is empty fall back to TargetName --> <PriIndexName Condition="$(PriIndexName) == ''">$(TargetName)</PriIndexName> </PropertyGroup> </Target>
- Run-time error in C++ apps that reference a C++ Windows Runtime Component: To resolve, add the below target to the end of the Windows Runtime Component’s .vcxproj:
- Known issues for WinUI applications with Single-project MSIX (Blank App, Packaged template):
- Missing Package & Publish menu item until you restart Visual Studio: When creating a new app with Single-project MSIX in both Visual Studio 2019 and Visual Studio 2022 using the Blank App, Packaged (WinUI 3 in Desktop) project template, the command to publish the project doesn’t appear in the menu until you close and re-open Visual Studio.
- A C# app with Single-project MSIX will not compile without the “C++ (v14x) Universal Windows Platform Tools” optional component installed. View Install developer tools for additional information.
- Potential run-time error in an app with Single-project MSIX that consumes types defined in a referenced Windows Runtime Component: To resolve, manually add activatable class entries to the appxmanifest.xml.
- The expected error in C# applications is “COMException: Class not registered (0x80040154 (REGDB_E_CLASSNOTREG)).
- The expected error in C++/WinRT applications is “winrt::hresult_class_not_registered”.
- Known issues for WinUI applications without MSIX-packaging (unpackaged apps):
- Some APIs require package identity and are not supported in unpackaged apps, such as:
- ApplicationData
- StorageFile.GetFileFromApplicationUriAsync
- StorageFile.CreateStreamedFileFromUriAsync
- ApiInformation (not supported on Windows 10)
- Package.Current
- Any API in the Windows.ApplicationModel.Resources namespace
- Any API in the Microsoft.Windows.ApplicationModel.Resources namespace
- Some APIs require package identity and are not supported in unpackaged apps, such as:
- Known issues for packaging and deploying WinUI applications:
- The
Package
command is not supported in WinUI apps with Single-project MSIX (Blank App, Packaged template). Instead, use thePackage & Publish
command to create an MSIX package. - To create a NuGet package from a C# Class Library with the
Pack
command, ensure the activeConfiguration
isRelease
. - The
Pack
command is not supported in C++ Windows Runtime Components to create a NuGet package.
- The
Windowing
The Windows App SDK provides an AppWindow class that evolves the previous easy-to-use Windows.UI.WindowManagement.AppWindow preview class and makes it available to all Windows apps, including Win32, WPF, and WinForms.
New Features
- AppWindow is a high-level windowing API that allows for easy-to-use windowing scenarios that integrates well with the Windows user experience and with other apps. Represents a high-level abstraction of a system-managed container of the content of an app. This is the container in which your content is hosted, and represents the entity that users interact with when they resize and move your app on screen. For developers familiar with Win32, the AppWindow can be seen as a high-level abstraction of the HWND.
- DisplayArea represents a high-level abstraction of a HMONITOR, follows the same principles as AppWindow.
- DisplayAreaWatcher allows a developer to observe changes in the display topology and enumerate DisplayAreas currently defined in the system.
Input
These are the input APIs that support WinUI and provide a lower level API surface for developers to achieve more advanced input interactions.
New Features
- Pointer APIs: PointerPoint, PointerPointProperties, and PointerEventArgs to support retrieving pointer event information with XAML input APIs.
- InputPointerSource API: Represents an object that is registered to report pointer input, and provides pointer cursor and input event handling for XAML’s SwapChainPanel API.
- Cursor API: Allows developers to change the cursor bitmap.
- GestureRecognizer API: Allows developers to recognize certain gestures such as drag, hold, and click when given pointer information.
Important limitations
- All PointerPoint static factory functions have been removed: GetCurrentPoint, GetCurrentPointTransformed, GetIntermediatePoints, and GetIntermediatePointsTransformed.
- The Windows App SDK doesn’t support retrieving PointerPoint objects with pointer IDs. Instead, you can use the PointerPoint member function GetTransformedPoint to retrieve a transformed version of an existing PointerPoint object. For intermediate points, you can use the PointerEventArgs member functions GetIntermediatePoints and GetTransformedIntermediatePoints.
- Direct use of the platform SDK API Windows.UI.Core.CoreDragOperation will not work with WinUI applications.
- PointerPoint properties RawPosition and ContactRectRaw were removed because they referred to non-predicted values, which were the same as the normal values in the OS. Use Position and ContactRect instead. Pointer prediction is now handled with the Microsoft.UI.Input.PointerPredictor API object.
App Lifecycle
Most of the App Lifecycle features already exist in the UWP platform, and have been brought into the Windows App SDK for use by desktop app types, especially unpackaged Console apps, Win32 apps, Windows Forms apps, and WPF apps. The Windows App SDK implementation of these features cannot be used in UWP apps, since there are equivalent features in the UWP platform itself.
Important
If you’re working on a UWP app, refer to the UWP migration guidance to learn more about migrating your app to Windows App SDK.
Non-UWP apps can also be packaged into MSIX packages. While these apps can use some of the Windows App SDK App Lifecycle features, they must use the manifest approach where this is available. For example, they cannot use the Windows App SDK RegisterForXXXActivation APIs and must instead register for rich activation via the manifest.
All the constraints for packaged apps also apply to WinUI apps, which are packaged, and there are additional considerations as described below.
Important considerations:
- Rich activation: GetActivatedEventArgs
- Unpackaged apps: Fully usable.
- Packaged apps: Usable, but these apps can also use the platform
GetActivatedEventArgs
. Note that the platform defines Windows.ApplicationModel.AppInstance whereas the Windows App SDK defines Microsoft.Windows.AppLifecycle.AppInstance. And while UWP apps can use theActivatedEventArgs
classes, such asFileActivatedEventArgs
andLaunchActivatedEventArgs
, apps that use the Windows App SDK AppLifecycle feature must use the interfaces not the classes (e.g,IFileActivatedEventArgs
,ILaunchActivatedEventArgs
, and so on). - WinUi apps: WinUI’s App.OnLaunched is given a Microsoft.UI.Xaml.LaunchActivatedEventArgs, whereas the platform
GetActivatedEventArgs
returns a Windows.ApplicationModel.IActivatedEventArgs, and the WindowsAppSDKGetActivatedEventArgs
returns a Microsoft.Windows.AppLifecycle.AppActivationArguments object which can represent a platformLaunchActivatedEventArgs
. - For more info, see Rich activation.
- Register/Unregister for rich activation
- Unpackaged apps: Fully usable.
- Packaged apps: Not usable use the app’s MSIX manifest instead.
- For more info, see Rich activation.
- Single/Multi-instancing
- Unpackaged apps: Fully usable.
- Packaged apps: Fully usable.
- WinUI apps: If an app wants to detect other instances and redirect an activation, it must do so as early as possible, and before initializing any windows, etc. To enable this, the app must define DISABLE_XAML_GENERATED_MAIN, and write a custom Main (C#) or WinMain (C++) where it can do the detection and redirection.
- RedirectActivationToAsync is an async call, and you should not wait on an async call if your app is running in an STA. For Windows Forms and C# WinUI apps, you can declare Main to be async, if necessary. For C++ WinUI and C# WPF apps, you cannot declare Main to be async, so instead you need to move the redirect call to another thread to ensure you don’t block the STA.
- For more info, see App instancing.
- Power/State notifications
- Unpackaged apps: Fully usable.
- Packaged apps: Fully usable.
- For more info, see Power management.
Known issue:
- File Type associations incorrectly encode %1 to be %251 when setting the Verb handler’s command line template, which crashes unpackaged Win32 apps. You can manually edit the Registry value to be %1 instead as a partial workaround. If the target file path has a space in it, then it will still fail and there is no workaround for that scenario.
- These Single/Multi-instancing bugs will be fixed in an upcoming servicing patch:
- AppInstance redirection doesn’t work when compiled for x86
- Registering a key, unregistering it, and re-registering it causes the app to crash
DWriteCore
DWriteCore is the Windows App SDK implementation of DirectWrite, which is the DirectX API for high-quality text rendering, resolution-independent outline fonts, and full Unicode text and layout support. DWriteCore is a form of DirectWrite that runs on versions of Windows down to Windows 10, version 1809 (10.0; Build 17763), and opens the door for you to use it cross-platform.
Features DWriteCore contains all of the features of DirectWrite, with a few exceptions.
Important limitations
- DWriteCore does not contain the following DirectWrite features:
- Per-session fonts
- End-user defined character (EUDC) fonts
- Font-streaming APIs
- Low-level rendering API support is partial.
- DWriteCore doesn’t interoperate with Direct2D, but you can use IDWriteGlyphRunAnalysis and IDWriteBitmapRenderTarget.
MRT Core
MRT Core is a streamlined version of the modern Windows Resource Management System that is distributed as part of the Windows App SDK.
Important limitations
- In .NET projects, resource files copy-pasted into the project folder aren’t indexed on F5 if the app was already built. As a workaround, rebuild the app. See issue 1503 for more info.
- In .NET projects, when a resource file is added to the project using the Visual Studio UI, the files may not be indexed by default. See issue 1786 for more info. To work around this issue, please remove the entries below in the CSPROJ file:
XML
<ItemGroup> <Content Remove="<image file name>" /> </ItemGroup> <ItemGroup> <PRIResource Remove="<resw file name>" /> </ItemGroup>
- For unpackaged C++ WinUI apps, the resource URI is not built correctly. To work around this issue, add the following in the vcxproj:
XML
<!-- Add the following after <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> --> <PropertyGroup> <AppxPriInitialPath></AppxPriInitialPath> </PropertyGroup>
Deployment
New Features and updates
- You can auto-initialize the Windows App SDK through the
WindowsPackageType project
property to load the Windows App SDK runtime and call the Windows App SDK APIs. See Create a WinUI 3 app for instructions. - Unpackaged apps can deploy Windows App SDK by integrating in the standalone Windows App SDK
.exe
installer into your existing MSI or setup program. For more info, see Windows App SDK deployment guide for unpackaged apps. - Unpackaged .NET apps can also use .NET wrapper for the bootstrapper API to dynamically take a dependency on the Windows App SDK framework package at run time. For more info about the .NET wrapper, see .NET wrapper library.
- Packaged apps can use the deployment API to verify and ensure that all required packages are installed on the machine. For more info about how the deployment API works, see the deployment guide for packaged apps.
Important limitations
- The .NET wrapper for the bootstrapper API is only intended for use by unpackaged .NET applications to simplify access to the Windows App SDK.
- Only MSIX packaged apps that are full trust or have the packageManagement restricted capability have the permission to use the deployment API to install the main and singleton package dependencies. Support for partial-trust packaged apps will be coming in later releases.
- When F5 testing an x86 app which uses the DeploymentManager.Initialize method on an x64 system, ensure that the x64 framework is first installed by running the WindowsAppRuntimeInstall.exe. Otherwise, you will encounter a NOT_FOUND error due to Visual Studio not deploying the x64 framework, which normally occurs through Store deployment or sideloading.
Other limitations and known issues
- No support for Any CPU build configuration: When adding the Windows App SDK to an existing .NET application or component that supports Any CPU, you must specify the desired architecture:
x86
,x64
orarm64
. - Upgrading from .NET 5 to .NET 6: When upgrading in the Visual Studio UI, you may run into build errors. As a workaround, manually update your project file’s TargetFrameworkPackage to the below:
XML
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
- C# Single-project MSIX app doesn’t compile if C++ UWP Tools aren’t installed. If you have a C# Single-project MSIX project, then you’ll need to install the C++ (v14x) Universal Windows Platform Tools optional component.
- Subsequent language VSIX fails to install into Visual Studio 2019 when multiple versions of Visual Studio 2019 are installed. If you have multiple versions of Visual Studio 2019 installed (e.g. Release and Preview) and then install the Windows App SDK VSIX for both C++ and C#, the second installation will fail. To resolve, uninstall the Single-project MSIX Packaging Tools for Visual Studio 2019 after the first language VSIX. View this feedback for additional information about this issue.
- If you want to
co_await
on the DispatcherQueue.TryEnqueue method, then use the resume_foreground helper function in the Windows Implementation Library (WIL):- Add a reference to Microsoft.Windows.ImplementationLibrary NuGet package.
- Add the
#include <wil/cppwinrt_helpers.h>
statement to your code file. - Use
wil::resume_foreground(your_dispatcher);
toco_await
the result.
Read more and find the download links at Microsoft here.
User forum
0 messages