首页 文章

使用WIX升级MSI

提问于
浏览
0

我正在使用WIX创建一个MSI安装程序 . 一切都很好,我能够创建自己的产品并创造一切 .

但是,当我想要创建升级时,它无法正常工作 .

我使用了以下代码,其中$(var.ProductUpgradeCode)被定义并用作product元素中的upgrade-code .

<Upgrade Id="$(var.ProductUpgradeCode)">
        <UpgradeVersion OnlyDetect="yes" Property="SELFFOUND"
            Minimum="$(var.ProductVersion)" IncludeMinimum="yes"
            Maximum="$(var.ProductVersion)" IncludeMaximum="yes" />
        <UpgradeVersion OnlyDetect="yes" Property="NEWERFOUND"
            Minimum="$(var.ProductVersion)" IncludeMinimum="no" />
    </Upgrade>


    <CustomAction Id="AlreadyUpdated" Error="[ProductName] has already been updated to [ProductVersion] or newer." />
    <CustomAction Id="NoDowngrade" Error="A later version of [ProductName] is already installed." />

    <InstallExecuteSequence>
        <Custom Action="AlreadyUpdated" After="FindRelatedProducts">SELFFOUND</Custom>
        <Custom Action="NoDowngrade" After="FindRelatedProducts">NEWERFOUND</Custom>
        <RemoveExistingProducts After="InstallFinalize"></RemoveExistingProducts>
    </InstallExecuteSequence>

在旧MSI中,产品ID =“GUID1”版本=“1.0.0”

在新MSI中,产品ID =“GUID2”版本=“1.0.1”

安装旧时,我尝试安装新的 . 旧MSI将启动并询问更改/修复/删除对话框 . 但是我想继续安装,当按下“Install”(在progressDlg之前)时,我想卸载旧版本 .

只有一个文件在1.0.0和1.0.1之间变化 . 我的所有文件都有自己的GUID集(不是自动)组件 .

怎么了 ?它是新的WIX版本的东西?我昨天下载了最新的一个 .

1 回答

  • 1

    假设您的新MSI中的其他一切都正确,我看到的错误是升级设置中有OnlyDetect = yes . 正如WiX文档所说“设置为”是“检测产品和应用程序但不卸载” . 所以从改变它开始 .

    请注意,使用MajorUpgrade元素更常见,它负责设置 . 如果没有详细日志,其他所有内容都不正确(例如MSI中的FindRelatedProducts) .

相关问题