使用 MSIX 发布 .Net Maui 应用程序时未生成应用程序安装文件

Fra*_*nco 5 visual-studio msix asp.net-blazor .net-maui

尝试使用 MSIX 发布 .Net Maui 应用程序,但未生成“应用程序安装文件”(.appinstaller) 及其所有内容。我正在使用 Visual Studio 发布方法(包括 SideLoading),右键单击项目并按“发布”。

使用 Windows 10。我的应用程序的 TargetPlatformMinVersion:

<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
Run Code Online (Sandbox Code Playgroud)

以下是我遵循的步骤:

右键单击该项目并选择发布,然后以下图像来自向导。

在此输入图像描述

在此输入图像描述

在此输入图像描述

在此输入图像描述

结果:

在此输入图像描述

在最后一张幻灯片中,捆绑设置为“否”,所需的操作系统为空白,我不知道这是否是问题,但如果是问题,我该如何解决这个问题。

然后我按“复制并关闭”,但 C:\Dev\Installer 中没有生成安装程序文件和 MSIX 捆绑文件。它是空的,但应该有一个捆绑包和一个安装程序文件,我可以使用它们将更新推送到用户已安装的应用程序。

我的项目中生成的设置:

<GenerateAppInstallerFile>True</GenerateAppInstallerFile>
        <AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
        <PackageCertificateKeyFile>..._TemporaryKey.pfx</PackageCertificateKeyFile>
        <AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
        <AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
        <AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
        <GenerateTestArtifacts>True</GenerateTestArtifacts>
        <AppInstallerUri>C:\Dev\Installer</AppInstallerUri>
        <HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
Run Code Online (Sandbox Code Playgroud)

F. *_*oni 5

编辑

事实证明,一些用户在安装应用程序时遇到了问题,我们必须将依赖项包含到应用程序安装程序中。您可以在生成的包文件夹内的 Dependency 文件夹中找到它们。

这是更新的版本:

<?xml version="1.0" encoding="utf-8"?>
<AppInstaller
    xmlns="http://schemas.microsoft.com/appx/appinstaller/2017/2"
    Version="1.0.0.0"
    Uri="uri where this file is stored (including the file name), i.e. the installer location" >

    <MainPackage
        Name="Application GUID found in project's properties"
        Publisher="This has to match exactly what is the subject in your second screenshot, e.g. CN=John Doe"
        Version="Your package version"
        ProcessorArchitecture="x64"
        Uri="The location of the generated MSIX file of the latest version" />

    <Dependencies>
        <Package
            Name="Microsoft.WindowsAppRuntime.1.1"
            Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"
            ProcessorArchitecture="x64"
            Uri="yourlocation/Dependencies/x64/Microsoft.WindowsAppRuntime.1.1.msix"
            Version="1005.616.1651.0" />
    </Dependencies>

    <UpdateSettings>
        <OnLaunch 
            HoursBetweenUpdateChecks="0" />
        <AutomaticBackgroundTask />
    </UpdateSettings>
</AppInstaller>
Run Code Online (Sandbox Code Playgroud)

原来的:

我有完全相同的问题。我按照发布向导操作,但文件.appinstallerindex.html文件均未生成,而包含 MSIX 文件和所有其他内容的文件夹正在按预期生成。

我开始认为这是 Visual Studio 的一个错误,所以我希望新版本能够解决这个问题。

.appinstaller现在,我设法通过创建自己的文件并将其放入安装程序位置来使其工作。我知道这不是一个确定的解决方案,因为它需要我在.appinstaller每次部署新版本时手动更新文件。至少我能够让客户端应用程序自动更新。

以下是该文件的示例:

<?xml version="1.0" encoding="utf-8"?>
<AppInstaller
    xmlns="http://schemas.microsoft.com/appx/appinstaller/2017/2"
    Version="1.0.0.0"
    Uri="uri where this file is stored (including the file name), i.e. the installer location" >

    <MainPackage
        Name="Application GUID found in project's properties"
        Publisher="This has to match exactly what is the subject in your second screenshot, e.g. CN=John Doe"
        Version="Your package version"
        ProcessorArchitecture="x64"
        Uri="The location of the generated MSIX file of the latest version" />

    <UpdateSettings>
        <OnLaunch 
            HoursBetweenUpdateChecks="0" />
        <AutomaticBackgroundTask />
    </UpdateSettings>
</AppInstaller>
Run Code Online (Sandbox Code Playgroud)

准备好部署新版本后,我会按照相同的发布向导生成包含 MSIX 文件的文件夹,然后需要使用正确的版本和 MSIX URI 手动更新上面的代码。

注意:我在 .NET MAUI Blazor 默认应用程序上对此进行了测试,因为我只想弄清楚如何部署和推送更新,更复杂的应用程序可能需要应用程序安装程序文件中的其他信息。