[wix-users] Checking for SQL Server x64

Brian Enderle brianke at gmail.com
Wed Jun 15 13:01:58 PDT 2016


I need to check a system to make sure SQL Server 2008 R2, 2012 or 2014 (all
64 bit versions) are installed before allowing the user to install the
program.

I started with the following condition to check that SQL 2014 is installed

    <!-- Go find the SQLServer 64-bit version from the registry. -->
    <Property Id="SQLVERSION" Value="NA">
      <RegistrySearch Id="SQLVERSION"
                      Type="raw"
                      Root="HKLM"
                      Key="SOFTWARE\Microsoft\Microsoft SQL Server"
                      Name="InstalledInstances" />
    </Property>

    <Condition Message="A 64 bit version of SQL Server 2008 R2 or later was
not found on this machine.">
      <![CDATA[(SQLVERSION <> "SQL2014")]]>
    </Condition>

When I run the installer on a machine with SQL 2014 x64, the installer
proceeds as I would expect.  When I run on a machine with just SQL 2008 R2
x64, the installer proceeds but I would expect it to display the condition
message and NOT proceed with installation.

I have a few questions concerning this:

1. Is the Key I am searching the correct key.  If SQL server 2014 x86 is
installed will HKLM\SOFTWARE\Microsoft\Microsoft SQL Server still equate to
'SQL2014'.  If so, is there a way to check the bitness of the installed SQL?

2. When I view the install log (run with verbose logging) I see this:

AppSearch: Property: SQLVERSION, Signature: SQLVERSION
MSI (c) (3C:FC) [15:52:17:369]: Note: 1: 2262 2: Signature 3: -2147287038

Is there a way to display the value assigned to SQLVERSION in the verbose
logging?

3. My final solution needs to check if SQL 2008 R2, SQL 2012 or SQL 2102 is
installed, something like:

<Condition Message="A 64 bit version of SQL Server 2008 R2 or later was not
found on this machine.">
      <![CDATA[(SQLVERSION <> "SQL2014")]]> AND  <![CDATA[(SQLVERSION <>
"SQL2012")]]> AND <![CDATA[(SQLVERSION <> "SQL2008R2")]]>
    </Condition>

Is this the correct way to do this?


Brian

If you can't explain it simply, you don't understand it well enough.  -
Albert Einstein


More information about the wix-users mailing list