We encountered a similar problem when we tried to deploy a named instance of SQL 2008 Express R2 with our shrink applicator. We really work by creating a custom bootloader. Below are copies of posts from our wiki that describe this, hopefully they will be helpful to others trying to do this.
It is important to note that in VS2012 / 2013 we still have to decide how to do this work with InstallShield LE (ISLE), so if you are making this decision now and plan to upgrade VS, then this is probably not worth finding a solution. which will work in ISLE.
SQL 2008 R2 Bootstrapper Prerequisite for Use in Installation Projects
From a line in VS2010, it is not possible to install SQL2008 Express R2 as a prerequisite for an installation project. The reason this is not possible is because there is no “boot device” for R2, only for 2008 Express. In addition, MS does not plan to add a bootloader for R2, since VS simply receives boot files for any version of SQL when this version of VS was released (R2 was released after VS2010).
Since there is no MS boot buffer for SQL 2008 R2, you need to create your own according to this article:
http://robindotnet.wordpress.com/2011/02/06/how-about-a-bootstrapper-package-for-sqlserver-express-2008-r2/
This boot script either creates an SQLEXPRESS instance if an older instance with this name does not exist, or upgrades an earlier instance named SQLEXPRESS to SQL Express 2008 R2.
NB: Changing the name of the SQL instance CANNOT be done with this, because the sqlversionchk.exe program used by the xml file is programmed to check only the SQLEXPRESS instance, and there is no way to pass its alternate name. We solved this problem by creating a new version of the above files that do not use sqlversionchk exe, but instead use the reg check to determine if SQL is installed, and if so, which version:
SQL 2008 R2 Named Instance of Bootstrapping
Purpose: Use the appropriate project setup for the VS Setup project (i.e., note that 2008 R2 is a prerequisite in the project prerequisites), and then install the installation project or upgrade your own named instance of SQL Server.
Success: we created a custom boot script for our version of the SQL application; it generally eliminates the SQLVersionCh.exe program.
What have we done:
We started with the robindotnet custom boot buffer as described above.
Then we removed all references to sqlversionchk.exe and replaced them with registry checks for what the current version of sql is. It is not as complicated as sqlversionchk, as it also checks if the SQL instance is suitable in the correct language and there are many conditions, if version x sql is currently installed, then it cannot be updated. however, for our purposes, this does not matter, since we control the instance (since it is a custom instance, not the default SQLEXPRESS instance), so we will know what versions it may be, and therefore we can check these versions.
Then, the bootloader works by simply checking the following four scenarios, of which only one should ever be true (i.e. four scenarios must be mutually exclusive)
Scenario 1: Platform: x86
Registry check: there is no registry value for our instance name Action: nothing in the registry, so SQL is not installed, if it is an x86 machine, install SQL
Scenario 2: Platform: x86
Registry Check: The registry value is not equal to the latest version of SQL that we use. Act. Update our existing custom instance with the name of the SQL instance being used.
This logic is theoretically erroneous if the installed version of SQL was a later version than the ones we are trying to install (since we will upgrade to an earlier version, which will fail), but this will never happen if the user decides to manually update our SQL instance that is uncontrollable.
Scenario 3: Platform: amd64 (note this does not mean that it is an amd machine, it is just a 64-bit installation of Windows)
Registry Check: There is no registry value for our instance name
Action: nothing in the registry, so SQL is not installed if it is a 64-bit SQL computer installation
Scenario 4: Platform: amd64
Registry Validation: The registry value does not match the latest version of SQL that we use. Action: Upgrade the existing custom named instance to the version of SQL we are currently using.
The complete boot file is described in detail at the end of this post.
How this custom bootloader will change in the future
We can check any version numbers that we like in the registry and determine which version is installed. Then we can control the execution. For example, if you need to upgrade to 2008 R2 before you can upgrade it to 2010, we can do this using the bypassIf construct and simply enter more options in the table above.
Our version of the bootloader:
Note that the name of the custom instance is "MVXBM"
<?xml version="1.0" encoding="utf-8" ?> <Package xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" Name="DisplayName" Culture="Culture" LicenseAgreement="eula.rtf"> <PackageFiles CopyAllPackageFiles="false"> <PackageFile Name="SQLEXPR32_x86_ENU.EXE" HomeSite="SqlExpr32Exe"/> <PackageFile Name="SQLEXPR_x64_ENU.EXE" HomeSite="SqlExpr64Exe"/> <PackageFile Name="eula.rtf"/> </PackageFiles> <InstallChecks> <RegistryCheck Property="SQLVersion" Key="HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\MVXBM\MSSQLServer\CurrentVersion" Value="CurrentVersion" /> </InstallChecks> <Commands Reboot="Defer"> <Command PackageFile="SQLEXPR32_x86_ENU.EXE" Arguments='/q /hideconsole /action=Install /features=SQL /instancename=MVXBM /enableranu=1 /sqlsvcaccount="NT Authority\Network Service" /AddCurrentUserAsSqlAdmin /skiprules=RebootRequiredCheck /IAcceptSQLServerLicenseTerms' EstimatedInstalledBytes="225000000" EstimatedInstallSeconds="420"> <InstallConditions> <FailIf Property="VersionNT" Compare="ValueNotExists" String="GeneralFailure"/> <FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.1.2" String="InvalidPlatformXP"/> <FailIf Property="VersionNT" Compare="VersionEqualTo" Value="5.2.0" String="InvalidPlatform2K3"/> <FailIf Property="VersionNT" Compare="VersionEqualTo" Value="5.2.1" String="InvalidPlatform2K3"/> <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/> <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel"/> <BypassIf Property="SQLVersion" Compare="ValueExists"/> </InstallConditions> <ExitCodes> <ExitCode Value="0" Result="Success"/> <ExitCode Value="1641" Result="SuccessReboot"/> <ExitCode Value="3010" Result="SuccessReboot"/> <ExitCode Value="-2067919934" Result="FailReboot"/> <ExitCode Value="-2067723326" Result="FailReboot"/> <ExitCode Value="-2067922937" Result="Fail" String="AdminRequired"/> <ExitCode Value="-2067529697" Result="Fail" String="AdminRequired"/> <ExitCode Value="-2067922943" Result="Fail" String="InvalidPlatformOSServicePacks"/> <ExitCode Value="-2067529717" Result="Fail" String="AnotherInstanceRunning"/> <ExitCode Value="-2067922440" Result="Fail" String="BetaComponentsFailure"/> <ExitCode Value="-2067922438" Result="Fail" String="BetaComponentsFailure"/> <ExitCode Value="-2067922430" Result="Fail" String="InvalidPlatformArchitecture"/> <ExitCode Value="-2067922429" Result="Fail" String="InvalidPlatformArchitecture"/> <ExitCode Value="216" Result="Fail" String="InvalidPlatformArchitecture"/> <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" /> </ExitCodes> </Command> <Command PackageFile="SQLEXPR32_x86_ENU.EXE" Arguments="/q /hideconsole /action=Upgrade /instancename=MVXBM /skiprules=RebootRequiredCheck /IAcceptSQLServerLicenseTerms" EstimatedInstalledBytes="225000000" EstimatedInstallSeconds="420"> <InstallConditions> <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel"/> <BypassIf Property="SQLVersion" Compare="ValueNotExists"/> <BypassIf Property="SQLVersion" Compare="ValueEqualTo" Value="10.50.1600.1"/> </InstallConditions> <ExitCodes> <ExitCode Value="0" Result="Success"/> <ExitCode Value="1641" Result="SuccessReboot"/> <ExitCode Value="3010" Result="SuccessReboot"/> <ExitCode Value="-2067919934" Result="FailReboot"/> <ExitCode Value="-2067723326" Result="FailReboot"/> <ExitCode Value="-2067922937" Result="Fail" String="AdminRequired"/> <ExitCode Value="-2067529697" Result="Fail" String="AdminRequired"/> <ExitCode Value="-2067922943" Result="Fail" String="InvalidPlatformOSServicePacks"/> <ExitCode Value="-2067529717" Result="Fail" String="AnotherInstanceRunning"/> <ExitCode Value="-2067922440" Result="Fail" String="BetaComponentsFailure"/> <ExitCode Value="-2067922438" Result="Fail" String="BetaComponentsFailure"/> <ExitCode Value="-2067922430" Result="Fail" String="InvalidPlatformArchitecture"/> <ExitCode Value="-2067922429" Result="Fail" String="InvalidPlatformArchitecture"/> <ExitCode Value="216" Result="Fail" String="InvalidPlatformArchitecture"/> <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" /> </ExitCodes> </Command> <Command PackageFile="SQLEXPR_x64_ENU.EXE" Arguments='/q /hideconsole /action=Install /features=SQL /instancename=MVXBM /enableranu=1 /sqlsvcaccount="NT Authority\Network Service" /AddCurrentUserAsSqlAdmin /skiprules=RebootRequiredCheck /IAcceptSQLServerLicenseTerms' EstimatedInstalledBytes="225000000" EstimatedInstallSeconds="420"> <InstallConditions> <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="amd64"/> <BypassIf Property="SQLVersion" Compare="ValueExists"/> </InstallConditions> <ExitCodes> <ExitCode Value="0" Result="Success"/> <ExitCode Value="1641" Result="SuccessReboot"/> <ExitCode Value="3010" Result="SuccessReboot"/> <ExitCode Value="-2067919934" Result="FailReboot"/> <ExitCode Value="-2067723326" Result="FailReboot"/> <ExitCode Value="-2067922937" Result="Fail" String="AdminRequired"/> <ExitCode Value="-2067529697" Result="Fail" String="AdminRequired"/> <ExitCode Value="-2067922943" Result="Fail" String="InvalidPlatformOSServicePacks"/> <ExitCode Value="-2067529717" Result="Fail" String="AnotherInstanceRunning"/> <ExitCode Value="-2067922440" Result="Fail" String="BetaComponentsFailure"/> <ExitCode Value="-2067922438" Result="Fail" String="BetaComponentsFailure"/> <ExitCode Value="-2067922430" Result="Fail" String="InvalidPlatformArchitecture"/> <ExitCode Value="-2067922429" Result="Fail" String="InvalidPlatformArchitecture"/> <ExitCode Value="216" Result="Fail" String="InvalidPlatformArchitecture"/> <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" /> </ExitCodes> </Command> <Command PackageFile="SQLEXPR_x64_ENU.EXE" Arguments="/q /hideconsole /action=Upgrade /instancename=MVXBM /skiprules=RebootRequiredCheck /IAcceptSQLServerLicenseTerms" EstimatedInstalledBytes="225000000" EstimatedInstallSeconds="420"> <InstallConditions> <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="amd64"/> <BypassIf Property="SQLVersion" Compare="ValueNotExists"/> <BypassIf Property="SQLVersion" Compare="ValueEqualTo" Value="10.50.1600.1"/> </InstallConditions> <ExitCodes> <ExitCode Value="0" Result="Success"/> <ExitCode Value="1641" Result="SuccessReboot"/> <ExitCode Value="3010" Result="SuccessReboot"/> <ExitCode Value="-2067919934" Result="FailReboot"/> <ExitCode Value="-2067723326" Result="FailReboot"/> <ExitCode Value="-2067922937" Result="Fail" String="AdminRequired"/> <ExitCode Value="-2067529697" Result="Fail" String="AdminRequired"/> <ExitCode Value="-2067922943" Result="Fail" String="InvalidPlatformOSServicePacks"/> <ExitCode Value="-2067529717" Result="Fail" String="AnotherInstanceRunning"/> <ExitCode Value="-2067922440" Result="Fail" String="BetaComponentsFailure"/> <ExitCode Value="-2067922438" Result="Fail" String="BetaComponentsFailure"/> <ExitCode Value="-2067922430" Result="Fail" String="InvalidPlatformArchitecture"/> <ExitCode Value="-2067922429" Result="Fail" String="InvalidPlatformArchitecture"/> <ExitCode Value="216" Result="Fail" String="InvalidPlatformArchitecture"/> <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" /> </ExitCodes> </Command> </Commands> <Strings> <String Name="DisplayName">SQL Server 2008 R2 Express - MVXBM</String> <String Name="Culture">en</String> <String Name="SqlExpr32Exe">http://download.microsoft.com/download/5/1/a/51a153f6-6b08-4f94-a7b2-ba1ad482bc75/SQLEXPR32_x86_ENU.exe</String> <String Name="SqlExpr64Exe">http://download.microsoft.com/download/5/1/a/51a153f6-6b08-4f94-a7b2-ba1ad482bc75/SQLEXPR_x64_ENU.exe</String> <String Name="AdminRequired">You do not have the permissions required to install SQL Server 2008 R2 Express. Please contact your administrator.</String> <String Name="GeneralFailure">An error occurred attempting to install SQL Server 2008 R2 Express.</String> <String Name="InvalidPlatformXP">Windows XP Service Pack 2 or later is required to install SQL Server 2008 R2 Express.</String> <String Name="InvalidPlatform2K3">Windows 2003 Service Pack 2 or later is required to install SQL Server 2008 R2 Express.</String> <String Name="MissingMSXml">SQL Server 2008 R2 Express 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 2008 R2 Express. Contact your application vendor.</String> <String Name="InvalidPlatformOSServicePacks">The current operating system does not meet Service Pack level requirements for SQL Server 2008 R2 Express. Install the most recent Service Pack from the Microsoft download center at http://www.microsoft.com/downloads before continuing setup.</String> <String Name="InvalidPlatformIE">This version of SQL Server 2008 R2 Express requires Internet Explorer version 6.0 with SP1 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 2008 R2 components, SQL Server Support Files, or .NET Framework 2.0 before continuing.</String> <String Name="InvalidPlatformArchitecture">This version of SQL Server 2008 R2 Express is not supported for the current processor architecture.</String> <String Name="InvalidUpgradeNotExpress">The instance of SQL Server 2005 named 'SQLEXPRESS' is a not an instance of SQL Server Express. It cannot be upgraded to SQL Server 2008 R2 Express.</String> <String Name="InvalidUpgradeNotExpressCore">The instance of SQL Server 2005 Express named 'SQLEXPRESS' contains components that are not included in SQL Server 2008 R2 Express. SQL Server 2008 R2 Express SP1 cannot upgrade this instance. Please use SQL Server 2008 R2 Express with Advanced Services instead.</String> <String Name="InvalidUpgradeLanguage">The instance of SQL Server 2005 Express named 'SQLEXPRESS' is a different language version than this SQL Server 2008 R2 Express. SQL Server 2008 R2 Express cannot upgrade this instance.</String> <String Name="InvalidUpgradeWoW">SQL Server 2008 R2 Express (x64) cannot upgrade the existing instance of SQL Server 2005 Express (x64 WoW) named 'SQLEXPRESS'. Uninstall this instance of SQL Server 2005 Express and retry installing SQL Server 2008 R2 Express (x64).</String> </Strings> </Package>