1

I am supposed to check via Wix if SQL Express 2014 (or higher) is installed if on Win7 and if SQL Express 2016 (or higher) if on Win10. How am I supposed to do that?

I am trying this now:

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

But it does not really cover the requirements.

hot33331
  • 805
  • 11
  • 25
  • No time to answer this right now. However, even [identifying Windows 10 is hard these days](https://stackoverflow.com/questions/49335885/windows-10-not-detecting-on-installshield/49343826#49343826) (please do read that link - maybe check that **WindowsBuild property**). Did you check adding a basic OR segment to the end of your existing condition there? One checks for lower Windows version and MSSQL2014, the other one checks for Windows10 or higher and MSSQL2016 (or higher)? If both conditions fail you abort? It is late - I might be having a blond moment. – Stein Åsmul Apr 16 '18 at 01:50
  • For pure checking of the machine state - in other words you only check the machine state and make no changes to the system - a custom action can be defendable, though [not desirable](https://stackoverflow.com/a/46179779/129130). If you foresee that you will need very fine-grained control of how the check is performed, a custom action is sometimes the only option. Depends on requirements - they tend to evolve. – Stein Åsmul Apr 20 '18 at 00:50

1 Answers1

2

Here is how it worked for me:

<!-- 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)]]>
hot33331
  • 805
  • 11
  • 25