WiX - 卸载 msi 时如何卸载捆绑包

问题描述:

我正在使用 WiX 安装我的 .msi,我正在使用 Bundle Element 生成一个 WiX Bundle.我尽量不在添加/删除程序"上显示捆绑包,所以我像这样设置捆绑包元素的属性:

Im using WiX to install my .msi, I´m generating a WiX Bundle using the Bundle Element. I try to not show the Bundle on "Add/Remove programs" so i set the properties of the Bundle element like this:

<Bundle Name="$(var.ProductName)" Version="!(bind.packageVersion.MSIPackage)" 
      Manufacturer="$(var.ProductManufacturer)" UpgradeCode="$(var.UpgradeCode)" 
      DisableRemove="yes" DisableModify="yes" DisableRepair="yes">

DisableRemove、DisableModify 和 DisableRepair 为yes"使捆绑包隐藏在添加/删除程序"下.

DisableRemove, DisableModify and DisableRepair to "yes" made the Bundle be hidden under "Add/Remove programs".

我的问题是当我卸载我的应用程序时,应用程序被正确卸载,但捆绑包仍然隐藏,所以当我尝试安装其他版本的应用程序时会导致一些问题,例如新捆绑包检测到还有其他安装包并执行一些版本检查等.

My problem is that when i Uninstall my application, the application is uninstalled correctly but the Bundle remains Hidden, so it cause some problems when i try to install other version of the App, for example the new Bundle detects that there are other Bundle installed and performs some versioning check and so on.

所以我的问题是:当从添加/删除程序"中卸载应用程序时,是否也可以卸载隐藏包?

So my question is: is possible to when the application in uninstalled from the "Add/Remove programs" uninstall the Hidden Bundle as well?

为了扩展 Tom 的答案,如果您从 Bundle 标签中删除 Disables

To expand on Tom's answer, if you remove the Disables from your Bundle tag

<Bundle Name="$(var.ProductName)" Version="!(bind.packageVersion.MSIPackage)"
        Manufacturer="$(var.ProductManufacturer)" UpgradeCode="$(var.UpgradeCode)">

您可以修改您的 MsiPackage 标签以在添加/删除程序中隐藏 MSI

You can modify your MsiPackage tag to hide the MSI from Add/Remove Programs

  <MsiPackage
      Id="YOUR-ID"
      Vital="yes"
      DisplayName="$(var.ProductName)"
      SourceFile="$(var.Source.TargetPath)">

    <MsiProperty Name="ARPSYSTEMCOMPONENT" Value="1"/>

  </MsiPackage>

这将在添加/删除程序中只留下一个条目.您的 Bundle 现在将处理安装和卸载的 UI,并将正确允许安装其他版本的 Bundle.

This will leave just one entry in Add/Remove Programs. Your Bundle will now handle the UI of the install and uninstall, and will correctly allow other versions of the bundle to be installed.