Windows 10 内部版本 19041 中面向开发人员的新增功能What's New for developers in Windows 10 build 19041

Windows 10 内部版本 19041(也称为 SDK 版本 2004)与 Visual Studio 2019 及相关工具和功能结合,为你提供创建出色 Windows 应用所需的一切。Windows 10 build 19041 (also known as SDK version 2004), in combination with Visual Studio 2019 and related tools and features, provide you with everything you need to create remarkable Windows apps. 只需在 Windows 10 上安装工具和 SDK,你便可以随时创建新的通用 Windows 应用,或了解如何使用 Windows 上的现有应用代码Install the tools and SDK on Windows 10 and you’re ready to either create a new Universal Windows app or explore how you can use your existing app code on Windows.

该版本集合了 Windows 开发人员感兴趣的新增和改进功能及指南。This is a collection of new and improved features and guidance of interest to Windows developers in this release. 有关已添加到 Windows SDK 的新命名空间的完整列表,请参阅 Windows 10 内部版本 19041 API 更改For a full list of new namespaces added to the Windows SDK, see the Windows 10 build 19041 API changes. 有关 Windows 10 中亮点功能的详细信息,请参阅 Windows 10 中的酷炫功能For more information on the highlighted features of Windows 10, see What's cool in Windows 10.

Windows 10 应用Windows 10 apps

功能Feature 说明Description
蓝牙音频播放Bluetooth audio playback 启用来自远程蓝牙连接设备的音频播放介绍如何使用 AudioPlaybackConnection 启用蓝牙连接的远程设备以播放本地计算机上的音频,从而实现诸如将电脑配置为模拟蓝牙扬声器的功能以及允许用户从手机收听音频等方案。Enable audio playback from remote Bluetooth-connected devices shows you how to use AudioPlaybackConnection to enable Bluetooth-connected remote devices to play back audio on the local machine, enabling scenarios such as configuring a PC to behave like a Bluetooth speaker and allowing users to hear audio from their phone.
C# 应用移植C# app porting 我们已对将 C# 应用程序移植到 C++/WinRT 的过程进行了记录。We’ve documented the process of porting a C# application to C++/WinRT. 将剪贴板示例从 C# 移植到 C++/WinRT 与上下文相关,并且基于特定的实际移植体验。Porting the Clipboard sample to C++/WinRT from C# is contextual, and based on a particular real-world porting experience. 与其关联的主题从 C# 移动到 C++/WinRT 对移植中所涉及的技术细节和步骤进行了更为详尽的介绍。Its companion topic Move to C++/WinRT from C# is a more encyclopedic look at the technical details and steps involved in porting.
C++/WinRTC++/WinRT 最新改进功能/新增功能汇总中,了解有关 C++/WinRT 针对生成时和运行时的性能改进的更新(与 Visual C++ 编译器团队共同实现)。Read about the updates to C++/WinRT regarding build-time and run-time performance improvements (achieved in concert with the Visual C++ compiler team), in Rollup of recent improvements/additions.
对于 C++/WinRT,我们向以下这些主题添加了更多信息:从 C++/CX 进行移植从 C# 进行移植简单 C++/WinRT Windows UI 库示例并发get_unknown() 以及使用 C++/WinRT 创建 XAML 自定义(模板化)控件For C++/WinRT, we added more info to these topics: porting from C++/CX, porting from C#, Simple C++/WinRT Windows UI Library example, Concurrency, get_unknown(), and XAML custom (templated) controls with C++/WinRT.
DirectXDirectX 对于多个以前版本的 Windows(从 Creators Update 到 Windows 10,版本 1903),我们引入了几个与 DirectX 相关的最新“新增功能”主题。We brought several DirectX-related "What's new" topics up to date for several past releases of Windows, from the Creators Update to Windows 10, version 1903. DirectWrite 中的新增功能DXGI 1.6 改进功能Direct3D 12 中的新增功能What's new in DirectWrite, DXGI 1.6 improvements, and What's new in Direct3D 12.
DirectXMathDirectXMath 我们发布了 21 个新的 DirectXMath 主题,其中涵盖两个矩阵结构及其成员函数和自由函数。We published 21 new DirectXMath topics, covering two matrix structures and their member functions and free functions. 例如 XMFLOAT3X4 结构The XMFLOAT3X4 structure is an example.
Direct3DDirect3D 使用具有高动态范围显示和高级颜色的 DirectX 提供了 Windows 高动态范围应用的最佳做法列表。Using DirectX with high dynamic range displays and advanced color provides a list of best practices for Windows high-dynamic-rnge apps.
ID3D11On12Device2 接口及其方法,使你能够获取通过 Direct3D 11 API 所创建的资源,并在 Direct3D 12 中使用它们。A new ID3D11On12Device2 interface, and its methods, enable you to take resources created through the Direct3D 11 APIs and use them in Direct3D 12.
Direct3D 12Direct3D 12 已添加 Direct3D 12 Core 1.0 功能级别,供仅用于计算的设备使用。The Direct3D 12 Core 1.0 Feature Level has been added, for use by compute-only devices.
已为 ID3D12Debug3 接口添加新主题。New topics habe been added for the ID3D12Debug3 interface.
Direct MLDirect ML 已将 18 个运算符添加到 DirectML,DirectML 是一个低级别硬件加速 API,WinML 基于此 API 进行生成。There 18 operators have been added to DirectML, the low-level hardware-accelerated API on which WinML is built. 例如 DML_ACTIVATION_SHRINK_OPERATOR_DESC 结构An example is the DML_ACTIVATION_SHRINK_OPERATOR_DESC structure.
错误报告Error reporting RoFailFastWithErrorContextInternal2 函数已添加到 Win32 中,这会引发一个异常,该异常可能包含其他错误上下文。The RoFailFastWithErrorContextInternal2 function has been added to Win32, which raises an exception which can contain additional error context.
机器学习Machine Learning Windows 机器学习现在支持 ONNX 版本 1.4 和 opset 9Windows Machine Learning now supports ONNX version 1.4 and opset 9.
使用 CloseModelOnSessionCreation API,可以在不再需要某个学习模型时自动关闭该模型,从而节省内存。The CloseModelOnSessionCreation API allows you to save memory by closing a learning model automatically once it is no longer needed.
WLANWi-Fi 添加了几个新的本机 WiFi 函数和结构,如 WlanDeviceServiceCommand 函数Several new Native WiFi functions and structures have been added, such as the WlanDeviceServiceCommand function.
Wi-Fi 热点 2Wi-Fi Hotspot 2 通过网站预配 Wi-Fi 配置文件描述了 Wi-Fi 热点 2 的新功能。Provision a Wi-Fi profile via a website describes new functionality for Wi-Fi Hotspot 2.
Windows Holographic 互操作Windows Holographic interop 添加了 windows.graphics.holographic.interop.h 标头以及 17 个 Win32 API。The windows.graphics.holographic.interop.h header has been added, with 17 Win32 APIs. 这些 API 用于在 Win32 和 Windows 运行时之间进行互操作。The APIs are for interoperating between Win32 and Windows Runtime. 虽然在 Windows 10 内部版本 18362 中添加了这些 API,但该标头是内部版本 19041 的新标头。While the APIs were added in Windows 10 build 18362, the header is new for build 19041.
Windows 套接字Windows Sockets 已对 Windows 套接字 2 SPI 内容进行了增强。Enhancements have been made to the Windows Sockets 2 SPI content. 我们改进和扩充的众多主题中的一个示例是 LPWSPEVENTSELECT 回调函数主题。An example of one of the many topics we improved and augmented is the LPWSPEVENTSELECT callback function topic.
XAML 岛 - 基础知识XAML Islands - basics 使用 XAML 岛在桌面 Windows 应用中托管 UWP XAML 控件。Host UWP XAMl controls in your desktop Windows apps with XAML islands. 了解如何在 WPF 应用中托管标准 UWP 控件以及如何在 C++ Win32 应用中托管标准 UWP 控件Learn how to host a standard UWP control in a WPF app, and host a standard UWP control in a C++ Win32 app.
XAML 岛 - 自定义控件XAML Islands - custom controls Microsoft.Toolkit.Win32.UI.XamlApplicationMicrosoft.Toolkit.Win32.UI.SDK NuGet 包使得在 .NET 和 C++ Win32 应用中托管自定义 UWP XAML 控件变得更加容易。The Microsoft.Toolkit.Win32.UI.XamlApplication and Microsoft.Toolkit.Win32.UI.SDK NuGet packages make it easier to host custom UWP XAML controls in .NET and C++ Win32 apps.
若要进行分步演练,请参阅在 WPF 应用中托管自定义 UWP 控件在 C++ Win32 应用中托管自定义 UWP 控件For step-by-step walkthroughs, see Host a custom UWP control in a WPF app and Host a custom UWP control in a C++ Win32 app.
最后,有关更复杂的 C++ Win32 方案的指南,请参阅 XAML 岛的高级方案Finally, for guidance on more complicated C++ Win32 scenarios, see Advanced scenarios for XAML Islands.

使用 Windows 进行生成Build with Windows

功能Feature 说明Description
Windows 开发环境Windows development environment Windows 开发环境文档提供了有关使用 Windows 跨各种平台进行开发所需的资源,有助于你实现可能具有的任何开发目标。The Windows development environment docs provide resources for using Windows to develop across a variety of platforms, to accomplish whatever development goals you might have.
Windows 上的 PythonPython on Windows Windows 上的 Python 部分为刚接触 Python 语言的开发人员以及希望使用 Windows 上提供的其他工具来优化其 Python 开发的开发人员提供信息。The Python on Windows section provides information for developers new to the Python language, as well as devs looking to optimize their Python development with other tools available on Windows. 了解如何为 Web 开发数据库交互设置 Python 环境。Learn how to set up your Python environment for web development and database interaction.
Windows 上的 NodeJSNodeJS on Windows 推荐用于 Node.js 开发环境的设置为在 Linux 服务器进行部署的高级开发人员提供了详细指南。The recommended setup for your Node.js development environment provides detailed guidelines for advanced developers deploying to Linux servers. 此外,还提供了常见 Node.js Web 框架数据库交互Docker 容器的设置说明。Also available are setup instructions for popular Node.js web frameworks, database interaction, and Docker containers.
Mac 到 WindowsMac to Windows 更改开发环境指南主要面向将其开发平台从 Mac 过渡到 Windows 的用户,并为类似的快捷方式和开发实用程序提供映射。Our guide to changing your dev environment is geared towards users transitioning their development platform from Mac to Windows, and provides mappings for comparable shortcuts and development utilities.
Windows 终端Windows Terminal 面向命令行工具和 shell(如命令提示符、PowerShell 和适用于 Linux 的 Windows 子系统 (WSL))用户的新式终端应用程序A modern terminal application for users of command line tools and shells like Command Prompt, PowerShell, and Windows Subsystem for Linux (WSL). 它的主要功能包括多个选项卡、窗格、Unicode 和 UTF-8 字符支持、GPU 加速文本呈现引擎,还可以用于创建你自己的主题并自定义文本、颜色、背景和快捷键绑定。Its main features include multiple tabs, panes, Unicode and UTF-8 character support, a GPU accelerated text rendering engine, and the ability to create your own themes and customize text, colors, backgrounds, and shortcut key bindings.
WSL 2WSL 2 现在提供新版本的适用于 Linux 的 Windows 子系统 (WSL)A new version of the Windows Subsystem for Linux (WSL) is now available. WSL 2 具有重新配置的体系结构,可以在 Windows 上运行实际的 Linux 内核,从而提高了文件系统的性能并增加了全系统调用兼容性。WSL 2 features reconfigured architecture to run an actual Linux kernel on Windows, increasing file system performance and adding full system call compatibility. 这一新的体系结构改变了 Linux 二进制文件与 Windows 和计算机硬件进行交互的方式,但仍然提供与之前版本的 WSL 中相同的用户体验。This new architecture changes how Linux binaries interact with Windows and your computer's hardware, but still provides the same user experience as in the previous version of WSL. 每个单独的 Linux 发行版都可以作为 WSL1 或 WSL2 发行版运行,可以并行运行,且可以随时进行更改。Each individual Linux distribution can run as a WSL1 or WSL2 distro, can be run side by side, and can be changed at any time.
安装 WSL 2 以开始使用。Install WSL 2 to get started.
探索有关 WSL 1 和 WSL 2 之间的用户体验更改的进一步信息。Explore further information on user experience changes between WSL 1 and WSL 2.
查看有关 WSL 2 的常见问题解答Check out the Frequently Asked Questions about WSL 2.

MSIX、打包和部署MSIX, packaging, and deployment

功能Feature 说明Description
MSIXMSIX 自上次发布 Windows 10 SDK 后,我们对 MSIX 打包格式进行了重要更新。Significant updates to the MSIX packaging format have been made since the last release of the Windows 10 SDK.
包含服务的打包Packaging with services MSIX 和 MSIX 打包工具现在支持包含服务的应用包MSIX and the MSIX Packaging Tool now support app packages that contain services.
MSIX 包中的脚本Scripts in MSIX packages 你可以使用包支持框架 (PSF) 在 MSIX 应用包中运行脚本,这使得 IT 专业人员能够在使用 MSIX 将应用程序打包后,根据用户环境动态​​自定义应用程序。You can use the Package Support Framework (PSF) to run scripts in an MSIX app package, enabling IT Pros to customize an application dynamically to the user's environment after it is packaged using MSIX.
强制实施包完整性Enforced package integrity 你现在可以通过使用程序包清单中的 uap10:PackageIntegrity 元素对 MSIX 包的内容强制实施包完整性。You can now enforce package integrity on the contents of MSIX packages by using the uap10:PackageIntegrity element in your package manifest. 通过 MSIX 打包工具创建 MSIX 包时,也可以强制实施包完整性。You can also enforce package integrity when you create MSIX packages via the MSIX Packaging Tool.
稀疏包Sparse packages 你可以通过生成稀疏包并将其注册到应用来向未打包到 MSIX 包中的桌面应用授予包标识符You can grant package identity to desktop apps that are not packaged in an MSIX package by building and registering a sparse package with your app. 此功能使得尚不能采用 MSIX 打包方式进行部署的桌面应用能够使用需要程序包标识符的 Windows 10 可扩展性功能。This feature enables desktop apps that are not yet able to adopt MSIX packaging for deployment to use Windows 10 extensibility features that require package identity.
托管应用Hosted apps 你现在可以创建托管应用You can now create hosted apps. 托管应用与父托管应用共享相同的可执行文件和定义,但其外观和行为类似于系统上的单独应用。Hosted apps share the same executable and definition as a parent host app, but they look and behave like a separate app on the system. 对于希望组件(如可执行文件或脚本文件)的行为类似于独立 Windows 10 应用,但该组件需要托管进程才能进行执行的应用场景,托管应用会很有用。Hosted apps are useful for scenarios where you want a component (such as an executable file or a script file) to behave like a standalone Windows 10 app, but the component requires a host process in order to execute. 托管应用可以具有其自己的开始磁贴、标识,且可以与 Windows 10 功能(如后台任务、通知、磁贴和共享目标)深度集成。A hosted app can have its own start tile, identity, and deep integration with Windows 10 features such as background tasks, notifications, tiles, and share targets.

Windows UI 库 (WinUI)Windows UI Library (WinUI)

功能Feature 说明Description
WinUI 2.4WinUI 2.4 WinUI 2.4 是 Windows UI 库的最新公共版本。WinUI 2.4 is the latest public release of the Windows UI Library. 所有版本的 WinUI 都为 Windows 应用提供了广泛的官方 UI 控件,并且它们是作为独立于 Windows SDK 的 NuGet 包提供的,因此适用于早期版本的 Windows 10。All versions of WinUI provide a wide assortment of official UI controls for your Windows apps, and are suppplied as a NuGet package independent of the Windows SDK, so they work on earlier versions of Windows 10. 按照这些说明安装 WinUI。Follow these instructions to install WinUI.
RadialGradientBrushRadialGradientBrush WinUI 2.4 中的新增功能,RadialGradientBrush 在椭圆内绘制,该椭圆由 Center、RadiusX 和 RadiusY 属性定义。New in WinUI 2.4, a RadialGradientBrush is drawn within an ellipse defined by Center, RadiusX, and RadiusY properties. 渐变的颜色开始于椭圆的中心之处,结束于半径之处。Colors for the gradient start at the center of the ellipse and end at the radius.
ProgressRingProgressRing WinUI 2.4 中的新增功能,ProgressRing 控件用于模式交互,其中用户会受到阻止,直到 ProgressRing 消失。New in WinUI 2.4, the ProgressRing control is used for modal interactions where the user is blocked until the ProgressRing disappears. 如果操作要求在该操作完成之前挂起与应用的大多数交互,请使用此控件。Use this control if an operation requires that most interaction with the app be suspended until the operation is complete.
TabViewTabView TabView 控件的更新提供了对选项卡呈现方式的更多控制。Updates to the TabView control provide you with more control over how to render tabs. 你可以设置未选定选项卡的宽度并仅显示一个图标以节省屏幕空间,还可以隐藏未选定选项卡上的“关闭”按钮,直到用户将鼠标悬停在该选项卡上时才进行显示。You can set the width of unselected tabs and show just an icon to save screen space, and can also hide the close button on unselected tabs until the user hovers over the tab.
TextBox 控件TextBox controls 如果启用了深色主题,则默认情况下,TextBox 系列控件的背景色在文本插入时仍保持为深色。When dark theme is enabled, the background color of TextBox family controls now remains dark by default on text insertion. 受影响的控件有 TextBoxRichEditBoxPasswordBoxEditable ComboBoxAutoSuggestBoxAffected controls are TextBox, RichEditBox, PasswordBox, Editable ComboBox, and AutoSuggestBox.
NavigationViewNavigationView NavigationView 控件现在支持分层导航,并包括 Left、Top 和 LeftCompact 显示模式。The NavigationView control now supports hierarchical navigation and includes Left, Top, and LeftCompact display modes. 对于显示页面类别、标识带有相关子页面的页面,或在具有链接到许多其他页面的中心式页面的应用内使用,分层的 NavigationView 非常有用。A hierarchical NavigationView is useful for displaying categories of pages, identifying pages with related child-pages, or using within apps that have hub-style pages linking to many other pages.
Windows UI 库Windows UI Gallery XAML 控件库中提供了每个 WinUI 功能的示例。Examples of each WinUI feature are available in the XAML Controls Gallery. 可在 Microsoft Store 上下载它,或在 Github 上查看源代码Download it on the Microsoft Store, or view the source code on Github.
以前的版本Previous versions 自 Windows 10 SDK 的上一个主要版本发布以来,我们还发布了 WinUI 2.3WinUI 2.2,这为 Windows 开发人员提供了更多新的 UI 功能。Since the previous major release of the Windows 10 SDK, WinUI 2.3 and WinUI 2.2 were also released, providing further new UI features for Windows devs.

示例Samples

以下示例应用已更新为面向 Windows 10 内部版本 19041。The following sample apps have been updated to target Windows 10 build 19041.

视频Videos

Windows 终端:快乐使用命令行的秘诀!Windows Terminal: the secret to command line happiness!

了解如何为工作流自定义 Windows 终端,并观看其运行中功能的演示。Learn about how to customize the Windows Terminal for your workflow, and see demos of its features in action. 观看视频,然后阅读文档以了解详细信息。Check out the video, then read the docs for more information.

WSL2:在适用于 Linux 的 Windows 子系统上更快地进行编码WSL2: Code faster on the Windows Subsystem for Linux

了解有关 WSL2(适用于 Linux 的 Windows 子系统新版本)以及为提高性能所进行的更改的全部信息。Learn all about WSL2, the new version of the Windows Subsystem for Linux, and what changes have been made to improve performance. 观看视频,然后阅读文档以了解详细信息。Check out the video, then read the docs for more information.

MSIX:适用于 Windows 10 的包桌面应用。MSIX: Package desktop apps for Windows 10. 替换已过期的安装程序。Replace outdated installers.

了解 MSIX(用于安装 Windows 应用的包格式),包括如何使用 Visual Studio 打包现有代码以及如何部署和分配应用。Learn about MSIX, the package format for installing Windows apps, including how to package your existing code with Visual Studio and how to deploy and distribute your app. 观看视频,然后阅读文档以了解详细信息。Check out the video, then read the docs for more information.