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. MySQL varchar详解

    说明:以下结果都是在mysql8.2及Innodb环境下测试. varcahr(255)是什么含义? varchar(255) 表示可以存储最大255个字符,至于占多少个字节由字符集决定. varch ...

  2. Loto实践干货(3) 测量CAN总线通讯数据

    Loto实践干货(3) 测量CAN总线通讯数据 最近在做运动控制卡的项目,调试样机的过程中,需要验证CAN总线通讯功能的正确性.以前只限于理论上认识CAN总线,使用的CANbus的通讯卡也是有上位机例 ...

  3. 带你快速入坑ES6

    一.了解ES6 1)ES6官网:http://www.ecma-international.org/ecma-262/6.0/ 2)Javascript是ECMAScript的实现和扩展 3)ES学习 ...

  4. java实战字符串2:中英字符串相互转换

    题目描述 输入字符串为中文拼音号码串或者英文号码串,如果输入是中文拼音号码串则转成英文号码串,如果输入是英文号码串则转成中文号码串. 特殊情况是英文号码串会出现Double + 英文数字或者拼音数值. ...

  5. #高精度,模拟,vector#C 前缀

    From 2020牛客NOIP赛前集训营-提高组(第二场) 传送门 分析 像我这么菜就只会模拟呀(考场CE全部爆零QWQ) 题意就是不断跳到下一个字母问总共跳的长度有多长, 首先用一个变量存下初始位置 ...

  6. 本周四晚19:00知识赋能第八期第2课丨ArkUI自定义组件

     9月21日19:00~20:00,第八期知识赋能第2节直播就要开始啦!本次直播将为同学们带来涂鸦小游戏的趣味体验,让大家全面了解ArkUI框架的应用,帮助你们在自己已有专业的基础上拓宽知识边界,学习 ...

  7. CMake 常用命令大全:提高项目构建效率

    CMake是一个跨平台.开源的构建工具,它可以自动生成Makefile或者Visual Studio等IDE的工程文件.它能够帮助开发者更方便地管理项目的构建过程,提高项目构建的效率.在本文中,我们将 ...

  8. Nacos 多个实例的服务调用失败

    在微服务开发阶段,开发人员会频繁启动服务. 这样Nacos上会经常出现一个服务存在多个实例,这是自己和其他同事都启动了同一个服务造成的. 此时使用OpenFeign对该服务进行远程调用,会有很大概率出 ...

  9. Qt 实现涂鸦板一:简易涂鸦板

    新建一个Qt项目,在 .h 文件中写入 #pragma once #include <QtWidgets/QWidget> #include "ui_xuexi.h" ...

  10. Mybatis总体框架设计

    Mybatis架构概览 Mybatis架构整体设计如下: 接口层和数据库交互的方式 Mybatis和数据库的交互方式有两种 使用传统的MyBatis提供的API: 使用Mapper接口 使用传统的My ...