UWP 应用程序侧载 - AppInstaller 未安装该应用程序

UWP app Sideloading - AppInstaller not installing the app

我正在尝试使用 .appinstaller 安装 UWP 应用程序。 在我的笔记本电脑 OS 处于 1909 之前,它工作正常。最近我们在 2022 年 5 月升级到 21H2 后,它停止安装并显示错误:- “应用程序安装失败并显示错误消息:应用程序安装程序操作失败,错误代码为 0x80D03002。详细信息:未知错误 (0x80d03002)"

如果我 运行 MSIX 文件,它也可以在 21H2 上正常安装。

已经尝试按照 中的建议启动交付优化服务 --- 似乎没有解决问题。
下面是 AppInstaller 的 xml 代码:-

Below is the xml code for AppInstaller:-

<?xml version="1.0" encoding="utf-8"?>
<AppInstaller
    Uri="http://XXX/TestApp.UWP.appinstaller"
    Version="2.2112.0.0" xmlns="http://schemas.microsoft.com/appx/appinstaller/2017/2">
    <MainBundle
        Name="TestUI"
        Version="2.2112.0.0"
        Publisher="CN=Test, OU=GIS, O=&quot;Test Corporation &quot;, L=Fremont, S=California, C=US"
        Uri="http://XXX/TestApp.UWP_2.2112.0.0_Test/TestApp.UWP_2.2112.0.0_x64.msixbundle" />
    <Dependencies>
        <Package
            Name="Microsoft.UI.Xaml.2.4"
            Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"
            ProcessorArchitecture="x64"
            Uri="http://XXX/TestApp.UWP_2.2112.0.0_Test/Dependencies/x64/Microsoft.UI.Xaml.2.4.appx"
            Version="2.42007.9001.0" />
        <Package
            Name="Microsoft.NET.Native.Framework.2.2"
            Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"
            ProcessorArchitecture="x64"
            Uri="http://XXX/TestApp.UWP_2.2112.0.0_Test/Dependencies/x64/Microsoft.NET.Native.Framework.2.2.appx"
            Version="2.2.29512.0" />
        <Package
            Name="Microsoft.NET.Native.Runtime.2.2"
            Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"
            ProcessorArchitecture="x64"
            Uri="http://XXX/TestApp.UWP_2.2112.0.0_Test/Dependencies/x64/Microsoft.NET.Native.Runtime.2.2.appx"
            Version="2.2.28604.0" />
        <Package
            Name="Microsoft.VCLibs.140.00"
            Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"
            ProcessorArchitecture="x64"
            Uri="http://XXX/TestApp.UWP_2.2112.0.0_Test/Dependencies/x64/Microsoft.VCLibs.x64.14.00.appx"
            Version="14.0.29231.0" />
    </Dependencies>
    <UpdateSettings>
        <OnLaunch
            HoursBetweenUpdateChecks="0" />
    </UpdateSettings>
</AppInstaller>

出于安全考虑,Microsoft 暂时禁用了应用程序安装程序协议。查看下面的 link 了解更多详情。

https://techcommunity.microsoft.com/t5/msix/the-ms-appinstaller-protocol-has-been-disabled/m-p/3038361

终于找到原因了。即使它作为网站托管,AppInstaller 也无法访问 Uri,因此我没有使用 Uri = "http://",而是使用了本地文件路径 Uri = "file://"

修复:

<?xml version="1.0" encoding="utf-8"?>
<AppInstaller
    Uri="file://XXX/TestApp.UWP.appinstaller"
    Version="2.2112.0.0" xmlns="http://schemas.microsoft.com/appx/appinstaller/2017/2">
    <MainBundle
        Name="TestUI"
        Version="2.2112.0.0"
        Publisher="CN=Test, OU=GIS, O=&quot;Test Corporation &quot;, L=Fremont, S=California, C=US"
        Uri="file://XXX/TestApp.UWP_2.2112.0.0_Test/TestApp.UWP_2.2112.0.0_x64.msixbundle" />
    <Dependencies>
        <Package
            Name="Microsoft.UI.Xaml.2.4"
            Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"
            ProcessorArchitecture="x64"
            Uri="file://XXX/TestApp.UWP_2.2112.0.0_Test/Dependencies/x64/Microsoft.UI.Xaml.2.4.appx"
            Version="2.42007.9001.0" />
        <Package
            Name="Microsoft.NET.Native.Framework.2.2"
            Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"
            ProcessorArchitecture="x64"
            Uri="file://XXX/TestApp.UWP_2.2112.0.0_Test/Dependencies/x64/Microsoft.NET.Native.Framework.2.2.appx"
            Version="2.2.29512.0" />
        <Package
            Name="Microsoft.NET.Native.Runtime.2.2"
            Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"
            ProcessorArchitecture="x64"
            Uri="file://XXX/TestApp.UWP_2.2112.0.0_Test/Dependencies/x64/Microsoft.NET.Native.Runtime.2.2.appx"
            Version="2.2.28604.0" />
        <Package
            Name="Microsoft.VCLibs.140.00"
            Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"
            ProcessorArchitecture="x64"
            Uri="file://XXX/TestApp.UWP_2.2112.0.0_Test/Dependencies/x64/Microsoft.VCLibs.x64.14.00.appx"
            Version="14.0.29231.0" />
    </Dependencies>
    <UpdateSettings>
        <OnLaunch
            HoursBetweenUpdateChecks="0" />
    </UpdateSettings>
</AppInstaller>