修复WinUI3应用缺失WindowsApp运行时环境提示
时间:2025-05-15 20:28:17 288浏览 收藏
本文详细介绍了如何解决在客户机器上运行非打包的WinUI 3应用程序时,缺少Windows App运行时环境提示的问题。通过确保使用Microsoft.WindowsAppSDK NuGet包的最新版本,并修改csproj项目文件中的特定设置,可以使WinUI 3应用程序像传统的Win32应用程序一样运行,无需用户额外安装Windows App运行时环境。文章提供了具体的步骤和配置示例,帮助开发者轻松实现这一目标。
This article will guide you on how to resolve the issue of a missing Windows App Runtime environment prompt when running non-packaged WinUI 3 applications on a customer's machine.
The prompt for a missing Windows App Runtime environment on the user's machine appears as follows:
By clicking "Yes," you will be directed to the download page at https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/downloads.
To resolve this issue, you can download and install the Windows App Runtime installation package, known as WindowsAppRuntimeInstall.exe.
However, requiring users to install additional files like WindowsAppRuntimeInstall.exe is not ideal for an application. This article will explain how to configure WinUI 3 applications to function like traditional Win32 applications, allowing them to be simply copied and run on a user's machine.
Step 1: Ensure that the Microsoft.WindowsAppSDK NuGet package is at version 1.2 or later. As of June 15, 2023, the latest version available is 1.3.230602002. The WindowsAppSdkUndockedRegFreeWinRTInitialize
feature, which helps avoid the aforementioned prompt, was introduced in version 1.2.
Step 2: Modify the csproj project file by setting WindowsAppSDKSelfContained to true and WindowsPackageType to None. When these settings are configured as such, the SDK automatically sets WindowsAppSdkUndockedRegFreeWinRTInitialize to true.
The updated csproj project file would look like this:
WinExe net6.0-windows10.0.19041 enable true x86;x64;x86 win10-x86;win10-x64 true None
After applying these modifications, you can publish the application independently, eliminating the need for users to install the Windows App Runtime environment. The application can be run by simply double-clicking it.
Due to the limited official documentation available on WindowsAppSdkUndockedRegFreeWinRTInitialize and UndockedRegFreeWinRT, I am not well-versed in their specifics. If you're interested in learning more, I recommend further exploration on your own.
终于介绍完啦!小伙伴们,这篇关于《修复WinUI3应用缺失WindowsApp运行时环境提示》的介绍应该让你收获多多了吧!欢迎大家收藏或分享给更多需要学习的朋友吧~golang学习网公众号也会发布文章相关知识,快来关注吧!
-
501 收藏
-
501 收藏
-
501 收藏
-
501 收藏
-
501 收藏
-
201 收藏
-
439 收藏
-
172 收藏
-
420 收藏
-
478 收藏
-
246 收藏
-
428 收藏
-
324 收藏
-
325 收藏
-
435 收藏
-
308 收藏
-
152 收藏
-
- 前端进阶之JavaScript设计模式
- 设计模式是开发人员在软件开发过程中面临一般问题时的解决方案,代表了最佳的实践。本课程的主打内容包括JS常见设计模式以及具体应用场景,打造一站式知识长龙服务,适合有JS基础的同学学习。
- 立即学习 542次学习
-
- GO语言核心编程课程
- 本课程采用真实案例,全面具体可落地,从理论到实践,一步一步将GO核心编程技术、编程思想、底层实现融会贯通,使学习者贴近时代脉搏,做IT互联网时代的弄潮儿。
- 立即学习 508次学习
-
- 简单聊聊mysql8与网络通信
- 如有问题加微信:Le-studyg;在课程中,我们将首先介绍MySQL8的新特性,包括性能优化、安全增强、新数据类型等,帮助学生快速熟悉MySQL8的最新功能。接着,我们将深入解析MySQL的网络通信机制,包括协议、连接管理、数据传输等,让
- 立即学习 497次学习
-
- JavaScript正则表达式基础与实战
- 在任何一门编程语言中,正则表达式,都是一项重要的知识,它提供了高效的字符串匹配与捕获机制,可以极大的简化程序设计。
- 立即学习 487次学习
-
- 从零制作响应式网站—Grid布局
- 本系列教程将展示从零制作一个假想的网络科技公司官网,分为导航,轮播,关于我们,成功案例,服务流程,团队介绍,数据部分,公司动态,底部信息等内容区块。网站整体采用CSSGrid布局,支持响应式,有流畅过渡和展现动画。
- 立即学习 484次学习