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

时间:2018-04-12 14:07:26

标签: sql-server wix

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

我现在正在尝试:

<!-- 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>

但它并没有真正涵盖这些要求。

1 个答案:

答案 0 :(得分:1)

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

<!-- 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)]]>