1

I'm having issues with writing a conditional for an install condition on two ExePackages. The first should install SQL Server 2012 Express on computers without an SQL Server installation running Win7 SP1 or higher. The second exepackage should install SQL Server 2008 R2 on computers without an SQL Server installation running on base Win 7 or lower. Currently, neither install conditions are working (these exepackages are bypassed). I've tested the DetectCondition and it does detect correctly, so it's something wrong with my InstallConditions. Here's what I'm working with (I've removed the InstallCommands):

<Property Id="Windows7">
  <![CDATA[(VersionNT = 600 OR VersionNT64 = 600)]]>
</Property>

<Property Id="ServicePack1AndBetter">
  <![CDATA[(ServicePackLevel >= 1)]]>
</Property>

<Property Id="Windows8AndHigher">
  <![CDATA[(VersionNT >= 602 OR VersionNT64 >= 602)]]>
</Property>

<Property Id="Windows7AndLower">
  <![CDATA[(VersionNT <= 601 OR VersionNT64 <= 601)]]>
</Property>

<Variable Name ='SqlVariable' Type ='string' Value ='/SAPWD=CMJsoftware4477'/>

<!--Read SQL Server keys to find current instance and version--> 
<util:RegistrySearch
  Id="SqlInstanceKeyFound"
  Root="HKLM" Key="SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL" Value="$(var.InstanceName)"
  Result="exists" Variable="SqlInstanceKeyFound" />
<util:RegistrySearch
  Id="SqlInstanceKey"
  Root="HKLM" Key="SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL" Value="$(var.InstanceName)"
  Variable="SqlInstanceKey" After="SqlInstanceKeyFound" Condition="SqlInstanceKeyFound" />
<util:RegistrySearch
  Id="SqlInstanceFound"
  Root="HKLM" Key="SOFTWARE\Microsoft\Microsoft SQL Server\[SqlInstanceKey]"
  Result="exists" Variable="SqlInstanceFound" After="SqlInstanceKey" Condition="SqlInstanceKeyFound" />
<util:RegistrySearch
  Id="SqlVersion"
  Root="HKLM" Key="SOFTWARE\Microsoft\Microsoft SQL Server\[SqlInstanceKey]\Setup" Value="Version"
  Variable="SqlVersion" After="SqlInstanceKey" Condition="SqlInstanceFound" />

<PackageGroup Id ="SqlServerExpress">
  <!--
    SQL Server 2012 Express - Install new instance
    http://msdn.microsoft.com/en-us/library/ms144259.aspx
    SQL Server Express requires WIndows Installer 4.5
    RepairCommand="/ACTION=Repair /INSTANCENAME=$(var.InstanceName) /Q /HIDECONSOLE"
  -->

  <ExePackage Id ="Sql2012Express"
              DisplayName="Microsoft SQL Server 2012 SP1 Express"
              Cache="yes"
              Compressed="no"
              PerMachine="yes"
              Permanent="yes"
              Vital="yes"
              Name="Microsoft SQL Server 2012 SP1 Express"
              SourceFile="$(var.PackagesDir)\SQLEXPR2012SP1_x86.exe"
              DownloadUrl="$(var.Sql2012SP1WebLink)"
              DetectCondition="SqlInstanceFound"
              InstallCondition="(Windows7 AND ServicePack1AndBetter) OR Windows8AndHigher">
    <ExitCode Value ="3010" Behavior ="forceReboot"/>
  </ExePackage>

  <ExePackage Id ="Sql2008R2Express"
              DisplayName="Microsoft SQL Server 2008 R2 Express"
              Cache="yes"
              Compressed="no"
              PerMachine="yes"
              Permanent="yes"
              Vital="yes"
              Name="Microsoft SQL Server 2008 R2 Express"
              SourceFile="$(var.PackagesDir)\SQLEXPR2008R2_x86.exe"
              DownloadUrl="$(var.Sql2008R2WebLink)"
              DetectCondition="SqlInstanceFound"
              InstallCondition="Windows7AndLower AND NOT (Windows7 AND ServicePack1AndBetter)">
    <ExitCode Value ="3010" Behavior ="forceReboot"/>
  </ExePackage>

Thanks.

rharr1234
  • 11
  • 1
  • The check used here might help: http://stackoverflow.com/questions/2733593/how-to-check-the-system-is-windows-7-or-windows-server-2008-r2-in-wix-installer – ProjectNapalm Dec 11 '15 at 19:53

0 Answers0