WiX Burn - 确定已经安装了哪些项目

标签 wix installation wix3.6 bootstrapper burn

我有一个刻录安装,用户可以选择安装三个选项中的哪一个 - 每个选项都直接与链中的三个 MsiPackages 之一相关,例如:

<Chain>
  <MsiPackage SourceFile="..\ProductA\bin\Release\ProductA.msi"  InstallCondition="chkProductA" />
  <MsiPackage SourceFile="..\ProductB\bin\Release\ProductB.msi"  InstallCondition="chkProductA" />
  <MsiPackage SourceFile="..\ProductC\bin\Release\ProductC.msi"  InstallCondition="chkProductC" />
</Chain>

一切都很好。但是,当我下次运行 msi 时,我只想重新安装/更新最初选择的项目 - 即如果只选择了 productA,我不想安装产品 B 和 C。

我如何确定最初选择的是什么?

最佳答案

好的,
排序它,所以我最好发布我的解决方案。

最终它归结为两个部分......

a) 在安装时设置的每个产品 MSI 中设置一个注册表项。显然,如果最初未安装该 MSI,则该注册表项将不存在。 IE。

  <!-- registry entry to state that the item has been installed-->
  <Component Id="cmp_WriteToRegistry" Guid="[yourguid]">
    <RegistryKey Root="HKLM"
                 Key="Software\MyCompany]"
          Action="createAndRemoveOnUninstall">
      <RegistryValue Type="integer" Name="ProductA" Value="1" KeyPath="yes"/>
    </RegistryKey>
  </Component>

b) 在升级时检查该注册表项是否存在刻录...
<!-- Determine what items are to be installed in the event of an install using the BA-->
<WixVariable Id="chkProductA" Value="![CDATA[chkProductA]]" />
<WixVariable Id="chkProductB" Value="![CDATA[chkProductB]]" />
<WixVariable Id="chkProductC" Value="![CDATA[chkProductC]]" />

<!-- Determine what items are installed in the event of an upgrade-->
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\MyCompany" Value="ProductAInstalled" Variable="ProductAInstalled" Result="exists" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\MyCompany" Value="ProductBInstalled" Variable="ProductBInstalled" Result="exists" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\MyCompany" Value="ProductCInstalled" Variable="ProductCInstalled" Result="exists" />

<Chain>
  <MsiPackage SourceFile="..\SetupProductA\bin\Release\SetupProductA.msi"
              InstallCondition="chkProductA OR ProductAInstalled" />
  <MsiPackage SourceFile="..\SetupProductB\bin\Release\SetupProductB.msi"
              InstallCondition="(chkProductB) OR (ProductBInstalled)" />
  <MsiPackage SourceFile="..\SetupProductC\bin\Release\SetupProductC.msi"
              InstallCondition="(chkProductC) OR (ProductCInstalled)" />
</Chain>

</Bundle>

所以在 InstallCondition 中,
当使用 UI 并选中相应的复选框时,chkProductA 评估为 true,并且
当相应的产品已经安装时,ProductAInstalled 评估为真 - 处理更新,在我的情况下发生没有任何用户交互。

当你知道怎么做的时候很容易。我当然不是一开始...

关于WiX Burn - 确定已经安装了哪些项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12917287/

相关文章:

mysql - 已经安装了 apache 和 mysql 的 XAMPP

wix - 使用 if 条件比较 WiX 中的变量值

wix - 从安装程序将安装位置写入注册表

wix:从上下文菜单中单击“修复”时显示错误消息框

wix - TeamCity 的 AssemblyInfo 修补程序的数字格式

wpf - 使用 WiX 从应用程序的主要升级上的 Windows 7 任务栏中删除固定应用程序的图标

.net - 如何将热量输出包含在 wix 文件中? (没有 Visual Studio 项目)

c++ - GeoDjango GDAL 安装

c# - WIX 安装程序,更改从另一个程序选择的安装文件夹?

WIX 错误 2716 : Couldn't create a random subcomponent name for component 'CopySTST'