如何在WiX 3.0中检查已安装的软件包?

Mac*_*Mac 5 wix wix3

我想检查是否已安装Crystal Reports Basic for Visual Studio 2008作为我自己的安装包的条件.

我在此产品的引导程序描述中找到了这个(C:\ Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\CrystalReports10_5\product.xml):

<InstallChecks>
  <MsiProductCheck Property="CRVSInstalled" Product="{AA467959-A1D6-4F45-90CD-11DC57733F32}"/>
  <MsiProductCheck Property="CRVSRunTimex86Installed" Product="{CE26F10F-C80F-4377-908B-1B7882AE2CE3}"/>
  <MsiProductCheck Property="CRVSRunTimex64Installed" Product="{2BFA9B05-7418-4EDE-A6FC-620427BAAAA3}. "/>
</InstallChecks>
Run Code Online (Sandbox Code Playgroud)

试图在WiX中模仿这种行为,我做了以下事情:

<Property Id="CRVSINSTALLED">
  <ComponentSearch Id="CRVSInstalledSearch" Guid="{AA467959-A1D6-4F45-90CD-11DC57733F32}" />
</Property>
<Property Id="CRVSRUNTIMEX86INSTALLED">
  <ComponentSearch Id="CRVSRunTimex86InstalledSearch" Guid="{CE26F10F-C80F-4377-908B-1B7882AE2CE3}" />
</Property>
<Property Id="CRVSRUNTIMEX64INSTALLED">
  <ComponentSearch Id="CRVSRunTimex64InstalledSearch" Guid="{2BFA9B05-7418-4EDE-A6FC-620427BAAAA3}" />
</Property>
<Condition Message="!(loc.CrystalReportsRequired)">Installed OR CRVSINSTALLED OR CRVSRUNTIMEX86INSTALLED OR CRVSRUNTIMEX64INSTALLED</Condition>
Run Code Online (Sandbox Code Playgroud)

但似乎ComponentSearch正在寻找具有自己的ID的包组件(文件,目录),而不是寻找包本身.

那我该怎么做呢?

Wim*_*nen 1

Windows 安装程序 API 具有执行此操作的MsiQueryProductState功能。msi.dll不幸的是,您必须编写自定义操作才能在安装程序中使用它。中的组件C:\Program Files\Windows Installer XML v3\SDK可能会使这变得更容易。