【问题标题】:Cannot perform upgrade and uninstall with WiX installer无法使用 WiX 安装程序执行升级和卸载
【发布时间】:2021-09-21 08:17:45
【问题描述】:

我有一个简单的安装程序,我希望能够执行升级和正确卸载,而不必每次都手动生成新 ID。

这是我的代码(相关部分):

<Product Id="*" UpgradeCode="$(var.UpgradeCode)" Name="$(var.ProductName)"
    Language="!(loc.Language)" Codepage='1252' Version="$(var.ProductVersion)" Manufacturer="$(var.Manufacturer)">

        <Package Id='*' Keywords='Installer' Description="My Installer" Manufacturer='$(var.Manufacturer)'
          InstallPrivileges='elevated' InstallScope='perMachine'
          InstallerVersion='200' Compressed='yes'/>

        <MajorUpgrade Schedule="afterInstallValidate"
                     DowngradeErrorMessage="A later version of [ProductName] is already installed"
                AllowSameVersionUpgrades="yes"
                AllowDowngrades="no" />
                
        <InstallUISequence>
            <Show Dialog="WelcomeDlg" After="CostFinalize" />
        </InstallUISequence>
</Product>

问题是我似乎无法使用相同的代码/安装程序进行升级和卸载。

如果我使用 Product Id="*",我可以执行升级,但是当我尝试卸载时,只会删除添加/删除程序中的条目。但是,已安装的文件仍保留在 Program Files 中。

如果我使用 Product Id="some random guid",我可以卸载,但我无法再执行升级。

所以我的问题是:

我可以使用通配符 ID(即 Product Id="*")执行升级和卸载,还是每次都必须手动生成一个新 ID?

谢谢!

【问题讨论】:

    标签: wix windows-installer upgrade uninstallation


    【解决方案1】:

    我在我的 WiX 安装程序中使用了 (Product Id="*"),它仍然能够执行升级和卸载。我的产品、包和主要升级代码看起来和你的几乎一样,所以我认为问题出在其他地方。

    您的产品部分是否有此信息来告诉 WiX 要安装/卸载哪些组件组? (见代码)

    <Feature Id="ProductFeature" Title="[ProductName]" Level="1">
            <ComponentGroupRef Id="ComponentGroup1" />
            <ComponentRef Id="DesktopApplicationShortcut" />
    </Feature>
    

    编辑:从那以后,我注意到另一件事可能对您有所帮助。我最近遇到了我的程序在卸载期间没有删除桌面快捷方式的问题,尽管它过去可以工作。此后,我将 Guid 从“*”更改为 Guid 代码,现在它已被删除。我认为这是识别组件的程序。

    <Component Id="DesktopApplicationShortcut" Guid="{Create Guid Code}">
    

    【讨论】:

      猜你喜欢
      • 2014-01-31
      • 1970-01-01
      • 2019-12-13
      • 2017-03-04
      • 1970-01-01
      • 2019-05-18
      • 2011-04-30
      • 1970-01-01
      • 2011-02-27
      相关资源
      最近更新 更多