This article will tell you how to fix the prompt for a missing Windows App Runtime environment 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 looks something like this:

This application requires the Windows App Runtime

Version 1.3

(MSIX package version >= 3000.882.2207.0)

Do you want to install a compatible Windows App Runtime now?

Clicking "Yes" will take you to the https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/downloads download page.

To fix this issue, you can download and install the Windows App Runtime installation package, WindowsAppRuntimeInstall.exe.

However, if an application requires users to install additional files like WindowsAppRuntimeInstall.exe, it is not ideal. This article will tell you how to make WinUI 3 applications work like traditional Win32 applications, where you can simply copy and run them on a user's machine.

Step 1: Make sure the Microsoft.WindowsAppSDK NuGet package is version 1.2 or higher. The latest version as of 2023.6.15 is 1.3.230602002. According to the official documentation, the WindowsAppSdkUndockedRegFreeWinRTInitialize feature was added in version 1.2. To avoid the prompt mentioned above, it is best to have the WindowsAppSdkUndockedRegFreeWinRTInitialize feature.

Step 2: Configure the csproj project file by setting WindowsAppSDKSelfContained to true and WindowsPackageType to None. By default, when WindowsAppSDKSelfContained is set to true and WindowsPackageType is set to None, WindowsAppSdkUndockedRegFreeWinRTInitialize is automatically configured to true in the SDK.

The modified csproj project file looks something like this:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows10.0.19041</TargetFramework>
<Nullable>enable</Nullable>
<UseWinUI>true</UseWinUI>
<Platforms>x86;x64;x86</Platforms>
<RuntimeIdentifiers>win10-x86;win10-x64</RuntimeIdentifiers> <!-- The following two lines of code are the core -->
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
<WindowsPackageType>None</WindowsPackageType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.3.230602002" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
</ItemGroup>
</Project>

After making the above modifications, you can independently publish the application without requiring users to install the Windows App Runtime environment. Simply double-click to run the application.

As there is currently a lack of official documentation on WindowsAppSdkUndockedRegFreeWinRTInitialize and UndockedRegFreeWinRT, I am not familiar with the details of this knowledge. If you are interested, please explore it on your own.

中文博客:WinUI 3 修复非打包应用运行提示缺少 Windows App Runtime 环境

Fixing Missing Windows App Runtime Environment Prompt for Unpackaged WinUI 3 Applications的更多相关文章

  1. windows如何解决Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion'

    问题再现与解读 首次,使用 java 命令+任意参数 都会报这个错误,最典型的就是java -version 解读一下这个报错信息,注册表路径 Software\JavaSoft\Java Runti ...

  2. 不可或缺 Windows Native (25) - C++: windows app native, android app native, ios app native

    [源码下载] 不可或缺 Windows Native (25) - C++: windows app native, android app native, ios app native 作者:web ...

  3. Eclipse中启动Tomcat报错:[There is insufficient memory for the Java Runtime Environment to continue.]的解决方案

    1,报错截图 2,报错信息 五月 08, 2018 9:57:58 上午 org.apache.tomcat.util.digester.SetPropertiesRule begin 警告: [Se ...

  4. java:安装Runtime Environment,设置Tomcat Server 的方法

    Eclipse 中开发Webapp, 一般需要配置Tomcat Server, 以便在Eclipse 中进行Debug.具体的步骤如下: 1. Windows ==>Preference ==& ...

  5. 使用 Portable Class Library(可移植类库)开发 Universal Windows App

    今天在这里跟大家聊聊关于 Windows Universal 应用夸平台的问题,首先Universal Windows App的定义相信大家已经有所了解了(如果你是一个刚刚接触 Universal A ...

  6. A fatal error has been detected by the Java Runtime Environment(jdk 1.6的一个BUG)

    几天做项目,生成一堆注解的实体,当实体数超过86个时,jvm报错: # # A fatal error has been detected by the Java Runtime Environmen ...

  7. 运行时环境(The Runtime Environment)

    App Engine应用响应网络请求.当一个客户端(典型的是用户的Web浏览器)使用HTTP请求(比如获取在URL上的网页)连接上应用的时候,网络请求就开始了.当App Engine接收到请求时,它会 ...

  8. 安装J2EE的SDK报错:could not find the required version of the Java(TM)2 Runtime Environment in '(null)'的解决办法。

    国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html内部邀请码:C8E245J (不写邀请码,没有现金送)国内私 ...

  9. java command line error opening registry key 'Software\JavaSoft\Java Runtime Environment' java.dll

    C:\Users\huxxxxchan>javaError: opening registry key 'Software\JavaSoft\Java Runtime Environment'E ...

  10. java安装1.8的经验和Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVers问题处理

            java安装1.8后的问题:之前安装了jdk1.7和jdk1.6,之后又安装jdk1.8,然后执行java -version,输出的是1.8的,后来在注册表把jdk1.8改为1.7,然 ...

随机推荐

  1. 记录--微信小程序,uniapp,H5端发送,显示emoji表情

    这里给大家分享我在网上总结出来的一些知识,希望对大家有所帮助 小伙伴们,在开发中有没有遇到过发布帖子或者实时聊天需要发送到一些emoji表情的. 但是每当我们直接将emoji表情提交到后台的接口又会报 ...

  2. Markdown的习题

    markdown的使用说明 习题1: 将这段话改为2级标题 习题2 试着在你的'Typora'中编辑下面的内容: 这是第一行 这是第2行 这是补充内容 这是第3行 习题3 将下面的内容改为指定的格式要 ...

  3. MacOS安装 JDK 及动态切换版本

    MacOS安装 JDK 及动态切换版本 JDK下载  我自己使用的是Mac m2系列.无所谓用的哪一种开源的OPEN JD,按需下载,我下载了8,11,17三个版本. 安装完成后,终端输入 java ...

  4. 懂一点前端—Vue快速入门

    01. 什么是 Vue Vue (读音 /vjuː/,类似于 view) 是一套用于构建用户界面的渐进式框架,是当下很火的一个 JavaScript MVVM 库,是以 数据驱动和组件化 的思想构建的 ...

  5. 《Effective Java》笔记 4~5

    4. 类和接口 15. 使类和成员的可访问性最小化 把API与实现清晰地隔离开,组件间通过API进行通信,不需要知道其他模块的内部工作情况,这称为:实现信息隐藏或封装 解耦系统中的各个组件 尽可能地使 ...

  6. Azkaban 2.5 Documentation

    Overview Azkaban was implemented at LinkedIn to solve the problem of Hadoop job dependencies. We had ...

  7. #2-SAT,平面图#洛谷 3209 [HNOI2010] 平面图判定

    题目传送门 分析 首先一张图是平面图的必要条件为 \(m\leq 3*n-6\), 然后考虑到这题的图存在哈密尔顿回路,也就是说非环边因为跨立形成奇环即为无解 那么直接拆点跑2-SAT就可以了 代码 ...

  8. #排列组合#美团2018年CodeM大赛-决赛 A-Exam

    题目 分析 因为第一名所在的学校一定会发喜报, 所以只有一个学校发喜报说明其它学校都没有发喜报 钦定第一名所在的学校为1,总方案要乘\(n\),那么两个1之间不可能出现两个相同的学校的学生 那么可以分 ...

  9. #dfs,trie#洛谷 4341 [BJWC2010]外星联络

    题目 分析 首先时间复杂度\(O(n^2)\)可过,统计子串个数可以用trie或者更高级的方法 可以枚举所有的后缀,然后建一个trie,这样这个trie就可以记录全部的子串 关于字典序排序,深搜的时候 ...

  10. 使用windbg分析dump文件

    使用windbg分析dump文件的步骤. 准备工作. 打开dump文件. 指定符号表文件的路径. 指定可执行文件的路径. 指定源码文件的路径. 在windbg的命令行,输入并执行如下命令 .reloa ...