WiX Burn - 确定已安装的项目

Fet*_*che 8 installation wix bootstrapper burn wix3.6

我有一个刻录安装,用户可以选择安装三个选项中的哪一个 - 每个选项直接与链中三个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>
Run Code Online (Sandbox Code Playgroud)

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

如何确定最初选择的内容?

Fet*_*che 10

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

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

a)在安装时设置的每个产品MSI中设置注册表项.显然,如果最初没有安装MSI,那么注册表项将不存在.即

  <!-- 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>
Run Code Online (Sandbox Code Playgroud)

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>
Run Code Online (Sandbox Code Playgroud)

因此,在InstallCondition中,当使用UI并检查相应的复选框时,chkProductA的计算结果为true,并且当已经安装了相应的产品时,ProductAInstalled的计算结果为true - 在我的情况下进行更新而不进行任何用户交互.

当你知道如何时很容易.我当然没有开始......