Thursday, June 07, 2007

Bootstrapper for MS SQL Server 2005 Express SP2

While trying to find out why Visual Studio 2005 Setup and Deployment Project fails to compile when I added MS SQL Server 2005 Express as the prerequisite, I came across SQL Server 2005 SP2 has been released and Bootstrapper for SQL Server 2005 Express Edition Service Pack 2. In the former article, Mike, developer for the SQL Server 2005 Express, said that his team is going to release a bootstrapper for SQL Server 2005 Express SP2 (so that it can be included in the prerequisite) in mid-March, but till now, nothing has been released. In the latter article, Adam Grocholski rolled out his own bootstrapper, but his SqlExpressSP2Chk.exe requires .NET Framework 2 to be installed, so it fails on a clean installation of Windows. Given these circumstances, I rolled out my own bootstrapper. What it does: 1) Checks that the OS supports SQL Express SP2. If not, flags an error. 2) Installs SQL Express SP2 if it is not installed. 3) Upgrades SQL Express to SP2 if a CTP, RTM or SP1 version is installed. Tested to be working on: 1) Clean installation of Windows XP SP2. If you want the bootstrapper too, just follow the following procedure. 1) Create the folder C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\SqlExpressSP2 2) Download SQL Express 2005 SP2 and place it in the above folder. 3) Create a product.xml in the above folder with the following content. This is where the installation logic resides.
<?xml version="1.0" encoding="utf-8"?>
<Product xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" ProductCode="Microsoft.Sql.Server.Express.SP2">
  <RelatedProducts>
    <DependsOnProduct Code="Microsoft.Net.Framework.2.0" />
    <DependsOnProduct Code="Microsoft.Windows.Installer.3.1" />
  </RelatedProducts>
  <PackageFiles CopyAllPackageFiles="false">
    <PackageFile Name="sqlexpr.exe" HomeSite="SqlExprExe" PublicKey="3082010A0282010100CD819638AE5CA2F2C1DFDED0AB958DD63C9D1F8BC35D862E5DF0B172F5ABAC886AB5DAB1227B0BC8C8A54B915E2213E9F9F5239DB5F46E76AEEFEEA43CC7C4C0595C3FABB3733326A662816179A162F46E8895D06EDDC79FD2A451117661BA708A65A1961689A75D81D04466E5DB569E40CAFCDC76242E443000E5D67D7B9511D5581DA3E84F0BC988DCA2D653996CCA63CA996A9A925E4C4D11E82FD35B5B5E5F52A3732DA5BB84450D8C191576CB08DA9AA67015E84DEC69FD5DB26B8FED295137388BC6464915945098B0F468A4D7DE097167749E778C1D856B97EAE75F45CCE0E6710DD16300937B31988E0BB413BDB3D0EEF1DF21EEA96061EE37433DC30203010001" />
  </PackageFiles>
  <InstallChecks>
    <RegistryCheck Property="SQLExpressVersion" Key="HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\SQLEXPRESS\MSSQLServer\CurrentVersion" Value="CurrentVersion" />
    <!-- Values: -->
    <!--   June CTP 9.00.1187.07 -->
    <!--   RTM      9.00.1399.06 -->
    <!--   SP1      9.00.2047.00 -->
    <!--   SP2      9.00.3042.00 -->
  </InstallChecks>
 
  <!-- Supported Operating Systems: Windows 2000 Service Pack 4; Windows Server 2003 Service Pack 1; Windows XP Service Pack 2 -->
  <Commands Reboot="Defer">
    <!-- Windows 2000 SP4 -->
    <!-- No SQL Express 2005 -->
    <!-- x86 -->
    <Command PackageFile="sqlexpr.exe" Arguments="-q /norebootchk /qn reboot=ReallySuppress addlocal=all instancename=SQLEXPRESS SQLAUTOSTART=1"
             EstimatedInstalledBytes="225000000" EstimatedTempBytes="225000000" EstimatedInstallSeconds="420">
      <InstallConditions>
        <!-- Skip if SQL 2005 Express CTP, RTM, SP1, SP2 or higher -->
        <BypassIf Property="SQLExpressVersion" Compare="VersionGreaterThanOrEqualTo" Value="9.00" />
        <!-- Skip if Windows XP, 2003 or higher -->
        <BypassIf Property="VersionNT" Compare="VersionGreaterThanOrEqualTo" Value="5.1" />
        <!-- Skip if x64 -->
        <BypassIf Property="ProcessorArchitecture" Compare="ValueEqualTo" Value="AMD64" />
 
        <!-- Block install if user does not have admin privileges -->
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired" />
        <!-- Block install on Windows 9x -->
        <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform" />
        <!-- Block install on OS less than Windows 2000 SP4 -->
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.0.4" String="InvalidPlatform2K" />
        <!-- Block install if NOT x86 -->
        <FailIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel" String="InvalidPlatformArchitecture"/>
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success" />
        <ExitCode Value="1641" Result="SuccessReboot" />
        <ExitCode Value="1706" Result="Fail" String="AnotherSqlServerInstalled"/>
        <ExitCode Value="3010" Result="SuccessReboot" />
        <ExitCode Value="50037" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50251" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50198" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50236" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50222" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="70003" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="50247" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="50248" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="70004" Result="Fail" String="AnotherInstanceRunning" />
        <ExitCode Value="70032" Result="Fail" String="BetaComponentsFailure" />
        <ExitCode Value="70033" Result="Fail" String="InvalidPlatformArchitecture" />
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>
    </Command>
 
    <!-- Windows 2000 SP4 -->
    <!-- No SQL Express 2005 -->
    <!-- x64 -->
    <Command PackageFile="sqlexpr.exe" Arguments="-q /norebootchk /qn reboot=ReallySuppress addlocal=all instancename=SQLEXPRESS SQLAUTOSTART=1"
             EstimatedInstalledBytes="225000000" EstimatedTempBytes="225000000" EstimatedInstallSeconds="420">
      <InstallConditions>
        <!-- Skip if SQL 2005 Express CTP, RTM, SP1, SP2 or higher -->
        <BypassIf Property="SQLExpressVersion" Compare="VersionGreaterThanOrEqualTo" Value="9.00" />
        <!-- Skip if Windows XP, 2003 or higher -->
        <BypassIf Property="VersionNT" Compare="VersionGreaterThanOrEqualTo" Value="5.1" />
        <!-- Skip if x86 -->
        <BypassIf Property="ProcessorArchitecture" Compare="ValueEqualTo" Value="Intel" />
 
        <!-- Block install if user does not have admin privileges -->
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired" />
        <!-- Block install on Windows 9x -->
        <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform" />
        <!-- Block install on OS less than Windows 2000 SP4 -->
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.0.4" String="InvalidPlatform2K" />
        <!-- Block install if NOT x64 -->
        <FailIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="AMD64" String="InvalidPlatformArchitecture"/>
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success" />
        <ExitCode Value="1641" Result="SuccessReboot" />
        <ExitCode Value="1706" Result="Fail" String="AnotherSqlServerInstalled"/>
        <ExitCode Value="3010" Result="SuccessReboot" />
        <ExitCode Value="50037" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50251" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50198" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50236" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50222" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="70003" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="50247" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="50248" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="70004" Result="Fail" String="AnotherInstanceRunning" />
        <ExitCode Value="70032" Result="Fail" String="BetaComponentsFailure" />
        <ExitCode Value="70033" Result="Fail" String="InvalidPlatformArchitecture" />
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>
    </Command>
 
    <!-- Windows XP SP2 -->
    <!-- No SQL Express 2005 -->
    <!-- x86 -->
    <Command PackageFile="sqlexpr.exe" Arguments="-q /norebootchk /qn reboot=ReallySuppress addlocal=all instancename=SQLEXPRESS SQLAUTOSTART=1"
             EstimatedInstalledBytes="225000000" EstimatedTempBytes="225000000" EstimatedInstallSeconds="420">
      <InstallConditions>
        <!-- Skip if SQL 2005 Express CTP, RTM, SP1, SP2 or higher -->
        <BypassIf Property="SQLExpressVersion" Compare="VersionGreaterThanOrEqualTo" Value="9.00" />
        <!-- Skip if OS less than Windows XP -->
        <BypassIf Property="VersionNT" Compare="VersionLessThan" Value="5.1" />
        <!-- Skip if Windows 2003 or higher -->
        <BypassIf Property="VersionNT" Compare="VersionGreaterThanOrEqualTo" Value="5.2" />
        <!-- Skip if x64 -->
        <BypassIf Property="ProcessorArchitecture" Compare="ValueEqualTo" Value="AMD64" />
 
        <!-- Block install if user does not have admin privileges -->
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired" />
        <!-- Block install on Windows 9x -->
        <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform" />
        <!-- Block install on OS less than Windows XP SP2 -->
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.1.2" String="InvalidPlatformXP" />
        <!-- Block install if NOT x86 -->
        <FailIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel" String="InvalidPlatformArchitecture"/>
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success" />
        <ExitCode Value="1641" Result="SuccessReboot" />
        <ExitCode Value="1706" Result="Fail" String="AnotherSqlServerInstalled"/>
        <ExitCode Value="3010" Result="SuccessReboot" />
        <ExitCode Value="50037" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50251" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50198" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50236" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50222" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="70003" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="50247" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="50248" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="70004" Result="Fail" String="AnotherInstanceRunning" />
        <ExitCode Value="70032" Result="Fail" String="BetaComponentsFailure" />
        <ExitCode Value="70033" Result="Fail" String="InvalidPlatformArchitecture" />
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>
    </Command>
 
    <!-- Windows XP SP2 -->
    <!-- No SQL Express 2005 -->
    <!-- x64 -->
    <Command PackageFile="sqlexpr.exe" Arguments="-q /norebootchk /qn reboot=ReallySuppress addlocal=all instancename=SQLEXPRESS SQLAUTOSTART=1"
             EstimatedInstalledBytes="225000000" EstimatedTempBytes="225000000" EstimatedInstallSeconds="420">
      <InstallConditions>
        <!-- Skip if SQL 2005 Express CTP, RTM, SP1, SP2 or higher -->
        <BypassIf Property="SQLExpressVersion" Compare="VersionGreaterThanOrEqualTo" Value="9.00" />
        <!-- Skip if OS less than Windows XP -->
        <BypassIf Property="VersionNT" Compare="VersionLessThan" Value="5.1" />
        <!-- Skip if Windows 2003 or higher -->
        <BypassIf Property="VersionNT" Compare="VersionGreaterThanOrEqualTo" Value="5.2" />
        <!-- Skip if x86 -->
        <BypassIf Property="ProcessorArchitecture" Compare="ValueEqualTo" Value="Intel" />
 
        <!-- Block install if user does not have admin privileges -->
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired" />
        <!-- Block install on Windows 9x -->
        <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform" />
        <!-- Block install on OS less than Windows XP SP2 -->
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.1.2" String="InvalidPlatformXP" />
        <!-- Block install if NOT x64 -->
        <FailIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="AMD64" String="InvalidPlatformArchitecture"/>
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success" />
        <ExitCode Value="1641" Result="SuccessReboot" />
        <ExitCode Value="1706" Result="Fail" String="AnotherSqlServerInstalled"/>
        <ExitCode Value="3010" Result="SuccessReboot" />
        <ExitCode Value="50037" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50251" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50198" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50236" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50222" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="70003" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="50247" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="50248" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="70004" Result="Fail" String="AnotherInstanceRunning" />
        <ExitCode Value="70032" Result="Fail" String="BetaComponentsFailure" />
        <ExitCode Value="70033" Result="Fail" String="InvalidPlatformArchitecture" />
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>
    </Command>
 
    <!-- Windows 2003 SP1 -->
    <!-- No SQL Express 2005 -->
    <!-- x86 -->
    <Command PackageFile="sqlexpr.exe" Arguments="-q /norebootchk /qn reboot=ReallySuppress addlocal=all instancename=SQLEXPRESS SQLAUTOSTART=1"
             EstimatedInstalledBytes="225000000" EstimatedTempBytes="225000000" EstimatedInstallSeconds="420">
      <InstallConditions>
        <!-- Skip if SQL 2005 Express CTP, RTM, SP1, SP2 or higher -->
        <BypassIf Property="SQLExpressVersion" Compare="VersionGreaterThanOrEqualTo" Value="9.00" />
        <!-- Skip if OS less than Windows 2003 -->
        <BypassIf Property="VersionNT" Compare="VersionLessThan" Value="5.2" />
        <!-- Skip if x64 -->
        <BypassIf Property="ProcessorArchitecture" Compare="ValueEqualTo" Value="AMD64" />
 
        <!-- Block install if user does not have admin privileges -->
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired" />
        <!-- Block install on Windows 9x -->
        <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform" />
        <!-- Block install on OS less than Windows 2003 SP1 -->
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.2.1" String="InvalidPlatformXP" />
        <!-- Block install if NOT x86 -->
        <FailIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel" String="InvalidPlatformArchitecture"/>
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success" />
        <ExitCode Value="1641" Result="SuccessReboot" />
        <ExitCode Value="1706" Result="Fail" String="AnotherSqlServerInstalled"/>
        <ExitCode Value="3010" Result="SuccessReboot" />
        <ExitCode Value="50037" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50251" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50198" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50236" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50222" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="70003" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="50247" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="50248" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="70004" Result="Fail" String="AnotherInstanceRunning" />
        <ExitCode Value="70032" Result="Fail" String="BetaComponentsFailure" />
        <ExitCode Value="70033" Result="Fail" String="InvalidPlatformArchitecture" />
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>
    </Command>
 
    <!-- Windows 2003 SP1 -->
    <!-- No SQL Express 2005 -->
    <!-- x64 -->
    <Command PackageFile="sqlexpr.exe" Arguments="-q /norebootchk /qn reboot=ReallySuppress addlocal=all instancename=SQLEXPRESS SQLAUTOSTART=1"
             EstimatedInstalledBytes="225000000" EstimatedTempBytes="225000000" EstimatedInstallSeconds="420">
      <InstallConditions>
        <!-- Skip if SQL 2005 Express CTP, RTM, SP1, SP2 or higher -->
        <BypassIf Property="SQLExpressVersion" Compare="VersionGreaterThanOrEqualTo" Value="9.00" />
        <!-- Skip if OS less than Windows 2003 -->
        <BypassIf Property="VersionNT" Compare="VersionLessThan" Value="5.2" />
        <!-- Skip if x86 -->
        <BypassIf Property="ProcessorArchitecture" Compare="ValueEqualTo" Value="Intel" />
 
        <!-- Block install if user does not have admin privileges -->
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired" />
        <!-- Block install on Windows 9x -->
        <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform" />
        <!-- Block install on OS less than Windows 2003 SP1 -->
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.2.1" String="InvalidPlatformXP" />
        <!-- Block install if NOT x64 -->
        <FailIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="AMD64" String="InvalidPlatformArchitecture"/>
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success" />
        <ExitCode Value="1641" Result="SuccessReboot" />
        <ExitCode Value="1706" Result="Fail" String="AnotherSqlServerInstalled"/>
        <ExitCode Value="3010" Result="SuccessReboot" />
        <ExitCode Value="50037" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50251" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50198" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50236" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50222" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="70003" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="50247" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="50248" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="70004" Result="Fail" String="AnotherInstanceRunning" />
        <ExitCode Value="70032" Result="Fail" String="BetaComponentsFailure" />
        <ExitCode Value="70033" Result="Fail" String="InvalidPlatformArchitecture" />
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>
    </Command>
 
 
 
    <!-- Windows 2000 SP4 -->
    <!-- SQL Express 2005 CTP, RTM, SP1 -->
    <!-- x86 -->
    <Command PackageFile="sqlexpr.exe" Arguments="-q /norebootchk /qn reboot=ReallySuppress reinstall=all reinstallmode=omus instancename=SQLEXPRESS SQLAUTOSTART=1"
             EstimatedInstalledBytes="225000000" EstimatedTempBytes="225000000" EstimatedInstallSeconds="420">
      <InstallConditions>
        <!-- Skip if no SQL Express -->
        <BypassIf Property="SQLExpressVersion" Compare="ValueNotExists" />
        <!-- Skip if NOT SQL 2005 Express CTP, RTM, SP1 -->
        <BypassIf Property="SQLExpressVersion" Compare="VersionLessThan" Value="9.00" />
        <BypassIf Property="SQLExpressVersion" Compare="VersionGreaterThanOrEqualTo" Value ="9.00.3042" />
        <!-- Skip if Windows XP, 2003 or higher -->
        <BypassIf Property="VersionNT" Compare="VersionGreaterThanOrEqualTo" Value="5.1" />
        <!-- Skip if x64 -->
        <BypassIf Property="ProcessorArchitecture" Compare="ValueEqualTo" Value="AMD64" />
 
        <!-- Block install if user does not have admin privileges -->
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired" />
        <!-- Block install on Windows 9x -->
        <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform" />
        <!-- Block install on OS less than Windows 2000 SP4 -->
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.0.4" String="InvalidPlatform2K" />
        <!-- Block install if NOT x86 -->
        <FailIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel" String="InvalidPlatformArchitecture"/>
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success" />
        <ExitCode Value="1641" Result="SuccessReboot" />
        <ExitCode Value="1706" Result="Fail" String="AnotherSqlServerInstalled"/>
        <ExitCode Value="3010" Result="SuccessReboot" />
        <ExitCode Value="50037" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50251" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50198" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50236" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50222" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="70003" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="50247" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="50248" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="70004" Result="Fail" String="AnotherInstanceRunning" />
        <ExitCode Value="70032" Result="Fail" String="BetaComponentsFailure" />
        <ExitCode Value="70033" Result="Fail" String="InvalidPlatformArchitecture" />
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>
    </Command>
 
    <!-- Windows 2000 SP4 -->
    <!-- SQL Express 2005 CTP, RTM, SP1 -->
    <!-- x64 -->
    <Command PackageFile="sqlexpr.exe" Arguments="-q /norebootchk /qn reboot=ReallySuppress reinstall=all reinstallmode=omus instancename=SQLEXPRESS SQLAUTOSTART=1"
             EstimatedInstalledBytes="225000000" EstimatedTempBytes="225000000" EstimatedInstallSeconds="420">
      <InstallConditions>
        <!-- Skip if no SQL Express -->
        <BypassIf Property="SQLExpressVersion" Compare="ValueNotExists" />
        <!-- Skip if NOT SQL 2005 Express CTP, RTM, SP1 -->
        <BypassIf Property="SQLExpressVersion" Compare="VersionLessThan" Value="9.00" />
        <BypassIf Property="SQLExpressVersion" Compare="VersionGreaterThanOrEqualTo" Value ="9.00.3042" />
        <!-- Skip if Windows XP, 2003 or higher -->
        <BypassIf Property="VersionNT" Compare="VersionGreaterThanOrEqualTo" Value="5.1" />
        <!-- Skip if x86 -->
        <BypassIf Property="ProcessorArchitecture" Compare="ValueEqualTo" Value="Intel" />
 
        <!-- Block install if user does not have admin privileges -->
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired" />
        <!-- Block install on Windows 9x -->
        <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform" />
        <!-- Block install on OS less than Windows 2000 SP4 -->
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.0.4" String="InvalidPlatform2K" />
        <!-- Block install if NOT x64 -->
        <FailIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="AMD64" String="InvalidPlatformArchitecture"/>
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success" />
        <ExitCode Value="1641" Result="SuccessReboot" />
        <ExitCode Value="1706" Result="Fail" String="AnotherSqlServerInstalled"/>
        <ExitCode Value="3010" Result="SuccessReboot" />
        <ExitCode Value="50037" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50251" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50198" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50236" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50222" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="70003" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="50247" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="50248" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="70004" Result="Fail" String="AnotherInstanceRunning" />
        <ExitCode Value="70032" Result="Fail" String="BetaComponentsFailure" />
        <ExitCode Value="70033" Result="Fail" String="InvalidPlatformArchitecture" />
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>
    </Command>
 
    <!-- Windows XP SP2 -->
    <!-- SQL Express 2005 CTP, RTM, SP1 -->
    <!-- x86 -->
    <Command PackageFile="sqlexpr.exe" Arguments="-q /norebootchk /qn reboot=ReallySuppress reinstall=all reinstallmode=omus instancename=SQLEXPRESS SQLAUTOSTART=1"
             EstimatedInstalledBytes="225000000" EstimatedTempBytes="225000000" EstimatedInstallSeconds="420">
      <InstallConditions>
        <!-- Skip if no SQL Express -->
        <BypassIf Property="SQLExpressVersion" Compare="ValueNotExists" />
        <!-- Skip if NOT SQL 2005 Express CTP, RTM, SP1 -->
        <BypassIf Property="SQLExpressVersion" Compare="VersionLessThan" Value="9.00" />
        <BypassIf Property="SQLExpressVersion" Compare="VersionGreaterThanOrEqualTo" Value ="9.00.3042" />
        <!-- Skip if OS less than Windows XP -->
        <BypassIf Property="VersionNT" Compare="VersionLessThan" Value="5.1" />
        <!-- Skip if Windows 2003 or higher -->
        <BypassIf Property="VersionNT" Compare="VersionGreaterThanOrEqualTo" Value="5.2" />
        <!-- Skip if x64 -->
        <BypassIf Property="ProcessorArchitecture" Compare="ValueEqualTo" Value="AMD64" />
 
        <!-- Block install if user does not have admin privileges -->
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired" />
        <!-- Block install on Windows 9x -->
        <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform" />
        <!-- Block install on OS less than Windows XP SP2 -->
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.1.2" String="InvalidPlatformXP" />
        <!-- Block install if NOT x86 -->
        <FailIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel" String="InvalidPlatformArchitecture"/>
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success" />
        <ExitCode Value="1641" Result="SuccessReboot" />
        <ExitCode Value="1706" Result="Fail" String="AnotherSqlServerInstalled"/>
        <ExitCode Value="3010" Result="SuccessReboot" />
        <ExitCode Value="50037" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50251" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50198" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50236" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50222" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="70003" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="50247" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="50248" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="70004" Result="Fail" String="AnotherInstanceRunning" />
        <ExitCode Value="70032" Result="Fail" String="BetaComponentsFailure" />
        <ExitCode Value="70033" Result="Fail" String="InvalidPlatformArchitecture" />
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>
    </Command>
 
    <!-- Windows XP SP2 -->
    <!-- SQL Express 2005 CTP, RTM, SP1 -->
    <!-- x64 -->
    <Command PackageFile="sqlexpr.exe" Arguments="-q /norebootchk /qn reboot=ReallySuppress reinstall=all reinstallmode=omus instancename=SQLEXPRESS SQLAUTOSTART=1"
             EstimatedInstalledBytes="225000000" EstimatedTempBytes="225000000" EstimatedInstallSeconds="420">
      <InstallConditions>
        <!-- Skip if no SQL Express -->
        <BypassIf Property="SQLExpressVersion" Compare="ValueNotExists" />
        <!-- Skip if NOT SQL 2005 Express CTP, RTM, SP1 -->
        <BypassIf Property="SQLExpressVersion" Compare="VersionLessThan" Value="9.00" />
        <BypassIf Property="SQLExpressVersion" Compare="VersionGreaterThanOrEqualTo" Value ="9.00.3042" />
        <!-- Skip if OS less than Windows XP -->
        <BypassIf Property="VersionNT" Compare="VersionLessThan" Value="5.1" />
        <!-- Skip if Windows 2003 or higher -->
        <BypassIf Property="VersionNT" Compare="VersionGreaterThanOrEqualTo" Value="5.2" />
        <!-- Skip if x86 -->
        <BypassIf Property="ProcessorArchitecture" Compare="ValueEqualTo" Value="Intel" />
 
        <!-- Block install if user does not have admin privileges -->
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired" />
        <!-- Block install on Windows 9x -->
        <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform" />
        <!-- Block install on OS less than Windows XP SP2 -->
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.1.2" String="InvalidPlatformXP" />
        <!-- Block install if NOT x64 -->
        <FailIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="AMD64" String="InvalidPlatformArchitecture"/>
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success" />
        <ExitCode Value="1641" Result="SuccessReboot" />
        <ExitCode Value="1706" Result="Fail" String="AnotherSqlServerInstalled"/>
        <ExitCode Value="3010" Result="SuccessReboot" />
        <ExitCode Value="50037" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50251" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50198" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50236" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50222" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="70003" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="50247" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="50248" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="70004" Result="Fail" String="AnotherInstanceRunning" />
        <ExitCode Value="70032" Result="Fail" String="BetaComponentsFailure" />
        <ExitCode Value="70033" Result="Fail" String="InvalidPlatformArchitecture" />
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>
    </Command>
 
    <!-- Windows 2003 SP1 -->
    <!-- SQL Express 2005 CTP, RTM, SP1 -->
    <!-- x86 -->
    <Command PackageFile="sqlexpr.exe" Arguments="-q /norebootchk /qn reboot=ReallySuppress reinstall=all reinstallmode=omus instancename=SQLEXPRESS SQLAUTOSTART=1"
             EstimatedInstalledBytes="225000000" EstimatedTempBytes="225000000" EstimatedInstallSeconds="420">
      <InstallConditions>
        <!-- Skip if no SQL Express -->
        <BypassIf Property="SQLExpressVersion" Compare="ValueNotExists" />
        <!-- Skip if NOT SQL 2005 Express CTP, RTM, SP1 -->
        <BypassIf Property="SQLExpressVersion" Compare="VersionLessThan" Value="9.00" />
        <BypassIf Property="SQLExpressVersion" Compare="VersionGreaterThanOrEqualTo" Value ="9.00.3042" />
        <!-- Skip if OS less than Windows 2003 -->
        <BypassIf Property="VersionNT" Compare="VersionLessThan" Value="5.2" />
        <!-- Skip if x64 -->
        <BypassIf Property="ProcessorArchitecture" Compare="ValueEqualTo" Value="AMD64" />
 
        <!-- Block install if user does not have admin privileges -->
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired" />
        <!-- Block install on Windows 9x -->
        <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform" />
        <!-- Block install on OS less than Windows 2003 SP1 -->
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.2.1" String="InvalidPlatformXP" />
        <!-- Block install if NOT x86 -->
        <FailIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel" String="InvalidPlatformArchitecture"/>
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success" />
        <ExitCode Value="1641" Result="SuccessReboot" />
        <ExitCode Value="1706" Result="Fail" String="AnotherSqlServerInstalled"/>
        <ExitCode Value="3010" Result="SuccessReboot" />
        <ExitCode Value="50037" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50251" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50198" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50236" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50222" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="70003" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="50247" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="50248" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="70004" Result="Fail" String="AnotherInstanceRunning" />
        <ExitCode Value="70032" Result="Fail" String="BetaComponentsFailure" />
        <ExitCode Value="70033" Result="Fail" String="InvalidPlatformArchitecture" />
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>
    </Command>
 
    <!-- Windows 2003 SP1 -->
    <!-- SQL Express 2005 CTP, RTM, SP1 -->
    <!-- x64 -->
    <Command PackageFile="sqlexpr.exe" Arguments="-q /norebootchk /qn reboot=ReallySuppress reinstall=all reinstallmode=omus instancename=SQLEXPRESS SQLAUTOSTART=1"
             EstimatedInstalledBytes="225000000" EstimatedTempBytes="225000000" EstimatedInstallSeconds="420">
      <InstallConditions>
        <!-- Skip if no SQL Express -->
        <BypassIf Property="SQLExpressVersion" Compare="ValueNotExists" />
        <!-- Skip if NOT SQL 2005 Express CTP, RTM, SP1 -->
        <BypassIf Property="SQLExpressVersion" Compare="VersionLessThan" Value="9.00" />
        <BypassIf Property="SQLExpressVersion" Compare="VersionGreaterThanOrEqualTo" Value ="9.00.3042" />
        <!-- Skip if OS less than Windows 2003 -->
        <BypassIf Property="VersionNT" Compare="VersionLessThan" Value="5.2" />
        <!-- Skip if x86 -->
        <BypassIf Property="ProcessorArchitecture" Compare="ValueEqualTo" Value="Intel" />
 
        <!-- Block install if user does not have admin privileges -->
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired" />
        <!-- Block install on Windows 9x -->
        <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform" />
        <!-- Block install on OS less than Windows 2003 SP1 -->
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.2.1" String="InvalidPlatformXP" />
        <!-- Block install if NOT x64 -->
        <FailIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="AMD64" String="InvalidPlatformArchitecture"/>
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success" />
        <ExitCode Value="1641" Result="SuccessReboot" />
        <ExitCode Value="1706" Result="Fail" String="AnotherSqlServerInstalled"/>
        <ExitCode Value="3010" Result="SuccessReboot" />
        <ExitCode Value="50037" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50251" Result="Fail" String="MissingMSXml" />
        <ExitCode Value="50198" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50236" Result="Fail" String="InsufficientHardware" />
        <ExitCode Value="50222" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="70003" Result="Fail" String="InvalidPlatformOSServicePacks" />
        <ExitCode Value="50247" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="50248" Result="Fail" String="InvalidPaltformIE" />
        <ExitCode Value="70004" Result="Fail" String="AnotherInstanceRunning" />
        <ExitCode Value="70032" Result="Fail" String="BetaComponentsFailure" />
        <ExitCode Value="70033" Result="Fail" String="InvalidPlatformArchitecture" />
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>
    </Command>
  </Commands>
  <Strings>
    <!-- <String Name="SqlExprExe32">http://go.microsoft.com/fwlink/?LinkId=65212&amp;clcid=0x409</String> -->
    <String Name="SqlExprExe">http://go.microsoft.com/fwlink/?LinkID=83387&amp;clcid=0x409</String>
  </Strings>
</Product>
4) Create the folder C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\SqlExpressSP2\en. I'll call this the en folder. 5) Copy eula.txt from C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\SqlExpress\en to the en folder. 6) Create a package.xml in the en folder with the following content. This is where the localized text resides.
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" Name="DisplayName" Culture="Culture" LicenseAgreement="eula.txt">
  <PackageFiles>
    <PackageFile Name="eula.txt"/>
  </PackageFiles>
 
  <!-- Defines a localizable string table for error messages-->
  <Strings>
    <String Name="DisplayName">SQL Server 2005 Express Edition SP2</String>
    <String Name="Culture">en</String>
    <String Name="AdminRequired">You do not have the permissions required to install SQL Server 2005 Express Edition SP2.  Please contact your administrator.</String>
    <String Name="GeneralFailure">An error occurred attempting to install SQL Server 2005 Express Edition SP2.</String>
    <String Name="InvalidPlatform">Windows 2000 or later is required to install SQL Server 2005 Express Edition SP2.</String>
    <String Name="InvalidPlatform2K">Windows 2000 Service Pack 4 or later is required to install SQL Server 2005 Express Edition SP2.</String>
    <String Name="InvalidPlatformXP">Windows XP Service Pack 2 or later is required to install SQL Server 2005 Express Edition SP2.</String>
    <String Name="MissingMSXml">SQL Server 2005 Express Edition requires MSXML. Please ensure MSXML is installed properly.</String>
    <String Name="InsufficientHardware">The current system does not meet the minimum hardware requirements for SQL Server 2005 Express Edition SP2. Contact your application vendor.</String>
    <String Name="InvalidPlatformOSServicePacks">The current operating system does not meet Service Pack level requirements for SQL Server 2005 Express Edition SP2. Install the most recent Service Pack from the Microsoft download center at http://www.microsoft.com/downloads before continuing setup.</String>
    <String Name="InvalidPaltformIE">This version of SQL Server 2005 Express Edition SP2 requires Internet Explorer version 6.0 with SP2 or later. To proceed, install or upgrade to a required version of Internet Explorer and then run setup again.</String>
    <String Name="AnotherInstanceRunning">Another instance of setup is already running. The running instance must complete before this setup can proceed.</String>
    <String Name="BetaComponentsFailure">A beta version of the .NET Framework 2.0 or SQL Server was detected on the computer. Uninstall any previous beta versions of SQL Server Yukon components, SQL Server Support Files, or .NET Framework 2.0 before continuing.</String>
    <String Name="InvalidPlatformArchitecture">This version of SQL Server 2005 Express Edition SP2 is not supported for the current processor architecture.</String>
    <String Name="ErrorDiskFull">There is not enough space on the destination disk for SQL Server 2005 Express Edition SP2.</String>
    <String Name="MissingNDP">The required version of the .NET Framework is not installed. Contact your application vendor.</String>
    <String Name="AnotherSqlServerInstalled">There is another version of SQL Server installed and it has stopped SQL Server 2005 Express Edition from installing. Uninstall it and run setup again if you want to install SQL Server 2005 Express.</String>
  </Strings>
</Package>
The bootstrapper creation is now complete. To use the bootstrapper follow the steps said by Adam Grocholski (copied here for your convenience): 1. Fire up Visual Studio 2005. 2. Create a Setup and Deployment project. 3. Go to the Projects menu and click Properties. 4. Click the Prerequisites button. 5. You should see an entry in the prerequisites list for SQL Server 2005 Express Edition SP2. 6. Select the prerequisite(s) you want and select the "Download prerequisites from the same locations as my application" option. 7. Click OK. 8. Click Apply and OK. 9. Build you Setup and Deployment project. 10. SQL Server Express 2005 SP2 will now be deployed with your application.
Edit: I've just realised that sqlexpr.exe should be instead placed in the en folder, and the related install logic should go there too, as sqlexpr.exe is a localized program. The Japanese version is another program by itself.

4 comments:

Jeow Li Huan said...

I've just realised that sqlexpr.exe should be instead placed in the en folder, and the related install logic should go there too, as sqlexpr.exe is a localized program. The Japanese version is another program by itself.

manan shah said...

I want to install my app with win xp 32 bit,64 bit,win 7 32bit,64 bit,also win8.

So, I have to add sqlexpr of wow edition(32 & 64 bit).

So How can I make prerequisite?

And what is CTP, RTM

manan shah said...

from where I can download SqlExpressSP2Chk.exe?

Jeow Li Huan said...

@manan shah, looks like the original blog post has been taken down, alongside the SqlExpressSP2Chk :(