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. .Net 8.0 下的新RPC,IceRPC之接口定义语言 [Slice] VS [Protobuf]

    作者引言 很高兴啊,我们来到了接口定义语言(IDL)篇,RPC之基石,有了它,可以在各种各种语言中实现RPC通讯. Slice 和 Protobuf 是什么? IceRPC的核心是一个面向字节byte ...

  2. 安全测试系列:《web安全深度剖析》读书笔记

    一 基础 1.http请求流程: 请求.响应报文格式: 8种请求方式,get(长度有限制).head(用于测试资源是否存在,服务器不返回消息主体).post(传输大量数据).put(给服务器上传资源) ...

  3. 线上gc问题-SpringActuator的坑

    整体复盘: 一个不算普通的周五中午,同事收到了大量了cpu异常的报警.根据报警表现和通过arthas查看,很明显的问题就是内存不足,疯狂无效gc.而且结合arthas和gc日志查看,老年代打满了,gc ...

  4. C++设计模式 - 装饰器(Decorator)

    单一职责模式: 在软件组件的设计中,如果责任划分的不清晰,使用继承得到的结果往往是随着需求的变化,子类急剧膨胀,同时充斥着重复代码,这时候的关键是划清责任. 典型模式 Decorator Bridge ...

  5. .Net接入AzureOpenAI、OpenAI、通义千问、智谱AI、讯飞星火、文心一言大语言模型。

    前言 现在在网上搜索.NET接入大模型的帖子很少,有些官方案例只提供java和python的SDK,所以有了这篇.Net的接入大模型文章,目前仅实现对话模型的调用. 这里仅举例通义千问,其他模型实现可 ...

  6. #SG函数#HDU 1848 Fibonacci again and again

    题目 分析 可取状态只能是斐波那契数,求出SG函数 然后判断三个数sg函数异或和不为0先手必胜 代码 #include <cstdio> #include <cctype> # ...

  7. OpenHarmony Meetup常州站招募令

    OpenHarmony Meetup 常州站正火热招募中! 诚邀充满激情的开发者参与线下盛会~ 探索OpenHarmony前沿科技,畅谈未来前景, 感受OpenHarmony生态构建之路的魅力! 线下 ...

  8. OpenHarmony加速行业应用落地,多款软件发行版正通过兼容性测评

    4 月 25 日,OpenAtom OpenHarmony(以下简称"OpenHarmony")技术日在深圳举办,大会聚焦 OpenHarmony 3.1 Release 版本核心 ...

  9. 许北林:我为什么加入OpenHarmony生态?又为什么要做“启航KP”开发套件?

    许北林 软通动力 资深项目经理 在全球开源趋势下,中国正逐渐成为全球开源软件的主要使用者和核心贡献者.今天我们来认识一位接触 OpenHarmony 不到一年,便带领团队成功开发出一款"启航 ...

  10. Numpy数组拼接和分裂

    将多个数组合并成一个,或将一个数组分裂成多个. 数组拼接 concatenate([a1, a2, ...], axis=0, out=None) #默认沿axis = 0轴拼接,也可设置沿axis ...