Wix:在 Win7 上检查一个版本的 SQLExpress,在 Win10 上检查另一个版本

Wix: Check for one version of SQLExpress on Win7, another on Win10

如果在 Win7 上,我应该通过 Wix 检查是否安装了 SQL Express 2014(或更高版本),如果在 Win10 上,是否安装了 SQL Express 2016(或更高版本)。我该怎么做?

我正在尝试这个:

<!-- SQLExpress -->
  <Property Id="SQLEXPRSEARCH" Value="0">
    <RegistrySearch Id="SqlExprSearch" 
                    Key="SOFTWARE\Microsoft\Microsoft SQL Server\SQLEXPRESS\MSSQLServer\CurrentVersion" 
                    Name="CurrentVersion" 
                    Root="HKLM" 
                    Type="raw" 
                    Win64="no"/>
  </Property>
  <Condition Message="This application requires Microsoft SQL Server Express 2014 Please install the Microsoft SQL Server then run this installer again.">
    <![CDATA[Installed OR (SQLEXPRSEARCH >= "12.0.2000.8" AND VersionNT >= 601)]]>
  </Condition>

但并没有真正满足要求。

以下是它对我有用的方法:

<!-- SQLExpress -->

<Property Id="SQLEXPRVERSION14X86" Value="0">
  <RegistrySearch Id="SqlExprVersion14x86"
                    Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft SQL Server SQLServer2014"
                    Name="Publisher"
                    Root="HKLM"
                    Type="raw"
                  Win64="no"/>
</Property>

 <Condition Message="This application requires Microsoft SQL Server Express 2014. Please install the Microsoft SQL Server then run this installer again.">
  <![CDATA[Installed OR (SQLEXPRVERSION14X86 = "Microsoft Corporation" AND (VersionNT < 602) AND NOT VersionNT64) OR (VersionNT > 602) OR (VersionNT64)]]>
</Condition>

<Property Id="SQLEXPRVERSION14X64" Value="0">
  <RegistrySearch Id="SqlExprVersion14x64"
                  Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft SQL Server SQLServer2014"
                  Name="Publisher"
                  Root="HKLM"
                  Type="raw"
                  Win64="yes"/>
</Property>

<Condition Message="This application requires Microsoft SQL Server Express 2014. Please install the Microsoft SQL Server then run this installer again.">
  <![CDATA[Installed OR (SQLEXPRVERSION14X64 = "Microsoft Corporation" AND (VersionNT < 602) AND VersionNT64) OR (VersionNT > 602) OR NOT (VersionNT64)]]>
</Condition>

<Property Id="SQLEXPRVERSION16X86" Value="0">
  <RegistrySearch Id="SqlExprVersion16x86"
                  Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft SQL Server SQLServer2016"
                  Name="Publisher"
                  Root="HKLM"
                  Type="raw"
                  Win64="no"/>
</Property>

<Condition Message="This application requires Microsoft SQL Server Express 2016. Please install the Microsoft SQL Server then run this installer again.">
  <![CDATA[Installed OR (SQLEXPRVERSION16X86 = "Microsoft Corporation" AND (VersionNT > 602) AND NOT VersionNT64) OR (VersionNT < 602) OR (VersionNT64)]]>
</Condition>

<Property Id="SQLEXPRVERSION16X64" Value="0">
  <RegistrySearch Id="SqlExprVersion16x64"
                  Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft SQL Server SQLServer2016"
                  Name="Publisher"
                  Root="HKLM"
                  Type="raw"
                  Win64="yes"/>
</Property>

<Condition Message="This application requires Microsoft SQL Server Express 2016. Please install the Microsoft SQL Server then run this installer again.">
  <![CDATA[Installed OR (SQLEXPRVERSION16X64 = "Microsoft Corporation" AND (VersionNT > 602) AND VersionNT64) OR (VersionNT < 602) OR NOT (VersionNT64)]]>