如何让 MSIX 应用程序安装程序在每次构建/发布期间输出正确的设置? [英] How do I get the MSIX appinstaller to output the correct settings during each build/publish?

查看:24
本文介绍了如何让 MSIX 应用程序安装程序在每次构建/发布期间输出正确的设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:

如何让 MSIX appinstaller 在每次构建/发布期间输出正确的设置?

How do I get the MSIX appinstaller to output the correct settings during each build/publish?

上下文:

这是为什么在启用旁加载时每次应用程序运行时 MSIX 不自动检查更新的后续问题?

我正在跑步:

  • Windows 10 20H2,操作系统内部版本 19042.928
  • Visual Studio 2019 社区版,版本 16.9.4

MSIX Windows 目标设置如下:

The MSIX Windows Targeting settings are as follows:

  • 目标版本 = Windows 10,版本 2004
  • 最低版本 = Windows 10,版本 1809

MSIX 安装程序项目创建了一个无效的 appinstaller 文件,这会阻止应用程序在每次运行时自动检查更新.我可以在每次构建/发布后手动更改文件,但我认为我不应该这样做,因为这似乎是弄巧成拙和错误的.

The MSIX installer project creates an invalid appinstaller file, which prevents the application from automatically checking for updates each time it runs. I can manually change the file after each build/publish, but I don't think I should have to do this because it seems both self-defeating and wrong.

一般来说,我几乎会忽略每次创建appinstaller,但文件会自动增加版本号.因此,似乎我目前陷入了某种形式的手动干预,要么更改 schema versionUpdateSettings 部分,要么更新路径中的版本.这可能与运行 Visual Studio 社区版有关吗?我需要专业人士才能让它工作吗?

Generally speaking, I would almost ignore creating the appinstaller each time, but the file auto-increments the version number. So, it seems like I am currently stuck with some form of manual intervention with either changing both the schema version and UpdateSettings section or update the version in the paths. Could this potentially be related to running Visual Studio Community edition? Do I need to have Professional in order to get it to work?

Visual Studio 创建的应用程序安装程序,这是错误的:

<?xml version="1.0" encoding="utf-8"?>
<AppInstaller
    Uri="https://<AppService>.azurewebsites.net/<AppName>.Setup.appinstaller"
    Version="<AppVersion>" xmlns="http://schemas.microsoft.com/appx/appinstaller/2017/2">
    <MainBundle
        Name="<SomeGuid>"
        Version="<AppVersion>"
        Publisher="CN=<CertificateName>"
        Uri="https://<AppService>.azurewebsites.net/<AppName>.Setup_<AppVersion>_Development_Test/<AppName>.Setup_<AppVersion>_x64_Development.msixbundle" />
    <UpdateSettings>
        <OnLaunch
            HoursBetweenUpdateChecks="0" />
    </UpdateSettings>
</AppInstaller>

我需要 Visual Studio 创建的应用程序安装程序:

<?xml version="1.0" encoding="utf-8"?>
<AppInstaller
    Uri="https://<AppService>.azurewebsites.net/<AppName>.Setup.appinstaller"
    Version="<AppVersion>" xmlns="http://schemas.microsoft.com/appx/appinstaller/2018">
    <MainBundle
        Name="<SomeGuid>"
        Version="<AppVersion>"
        Publisher="<CertificateName>"
        Uri="https://<AppService>.azurewebsites.net/<AppName>.Setup_<AppVersion>_Development_Test/<AppName>.Setup_<AppVersion>_x64_Development.msixbundle" />
    <UpdateSettings>
        <OnLaunch
            HoursBetweenUpdateChecks="0"
            ShowPrompt="true"
            UpdateBlocksActivation="true" />
        <AutomaticBackgroundTask />
        <ForceUpdateFromAnyVersion>true</ForceUpdateFromAnyVersion>
    </UpdateSettings>
</AppInstaller>

推荐答案

我们解决了即使启用了旁加载,应用程序也不检查自动更新的问题.我们需要向 App Installer 类型的 MSIX 项目添加一个附加项.这将创建 Package.appinstaller* 的默认文件名.此文件提供了 appinstaller 文件的配置设置,这是控制所有可用设置(包括 UpdateSettings 部分)所必需的.

We resolved the issue with the application not checking for automatic updates even though sideloading is enabled. We need to add an additional item to the MSIX project of type App Installer. This will create a default file name of Package.appinstaller*. This file provides the configuration settings for the appinstaller file, which are needed in order to control all available settings, including the UpdateSettings section.

appinstaller 允许的一些附加功能是阻止用户在不更新的情况下运行应用程序.这是 ClickOnce 发布配置文件的一个问题,因为它为用户提供了跳过更新的选项;我们无法找到防止这种情况的方法.但是,MSIX 应用安装程序允许控制此行为.

Some additional features that the appinstaller allows for is to block the user from running the application without updating. This was a concern with the ClickOnce publish profile because it gave the user the option to skip the update; we were unable to find a way to prevent this. The MSIX appinstaller, however, allows for control over this behavior.

* 请勿重命名此文件,因为构建/发布实用程序不会选择它并将设置应用到应用程序文件中.这似乎是一个错误/静态文件引用.

*​DO NOT RENAME THIS FILE BECAUSE THE BUILD/PUBLISH UTILITY WILL NOT PICK IT UP AND APPLY THE SETTINGS TO THE APPINSTALLER FILE. THIS APPEARS TO BE A BUG/STATIC-FILE-REFERENCE.

Package.appinstaller

<?xml version="1.0" encoding="utf-8"?>
<AppInstaller Uri="{AppInstallerUri}"
              Version="{Version}"
              xmlns="http://schemas.microsoft.com/appx/appinstaller/2018">

  <MainBundle Name="{Name}"
              Version="{Version}"
              Publisher="{Publisher}"
              Uri="{MainPackageUri}"/>

  <UpdateSettings>
    <OnLaunch
        HoursBetweenUpdateChecks="0"
        ShowPrompt="true"
        UpdateBlocksActivation="true" />
    <AutomaticBackgroundTask />
    <ForceUpdateFromAnyVersion>true</ForceUpdateFromAnyVersion>
  </UpdateSettings>

</AppInstaller>

参考:

其他参考资料:

这篇关于如何让 MSIX 应用程序安装程序在每次构建/发布期间输出正确的设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆