Thursday, August 27, 2009

VS.NET 2008 Bootstrapper for SQL Server 2008 Express Edition with Tools

I looked all over for this, and ended up just making my own custom prerequisite. There's an ugly hack to add a prerequisite for SQL Server 2008 Express, but I needed to have the edition that installs the tools as well. For whatever reason, adding the tools at a later date is not really a feasible approach with the installers that Microsoft has available.

However, the installer that includes tools also has Powershell as a prerequisite, so I was forced to make that one as well as my google mojo couldn't locate any.

To create the Powershell prerequisite:
  1. Create a new folder named 'Powershell1_0' under C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages
  2. In that new folder, create a file named 'product.xml'

    EDIT 2009-11-06: XML is case-sensitive, and the previous xml for product.xml had everything in lowercase. Please retry with proper casing as shown below.
    Save the following as the contents of that file:

    <!-- Windows Powershell 1.0 VS Bootstrapper : product.xml : Language neutral information -->
    <Product xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" ProductCode="Microsoft.Windows.PowerShell.1.0">

    </Product>
  3. Create a new subfolder named 'en' under the 'Powershell1_0' folder
  4. In the 'en' folder, create a file named 'package.xml'
    Save the following as the contents of that file:

    <?xml version="1.0" encoding="utf-8" ?>

    <Package
    xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
    Name="DisplayName"
    Culture="Culture"
    LicenseAgreement="eula.rtf"
    >

    <!-- Defines list of files to be copied on build -->
    <PackageFiles CopyAllPackageFiles="false">
    <PackageFile Name="eula.rtf"/>
    <PackageFile Name="Windows6.0-KB928439-x86.msu" HomeSite="ps10vistax86"
    PublicKey="3082010A0282010100D8DC95E9D1BA58324004219BF57E8C7581752EA5DD411D6AAD3D5E0DA7CEF775EBA20C1921B28669D291B3AE251B8060CA0B163CF8FEDF7A896A77D0F62BD8377AA7D3112E2DD7BE1895757B4239C28C27C258A031410EAEB94B44502450699167A9A1D56A5AA17E865B35C92A0314E16028515F45850075CC64D7ABB27C95A67A9E0C0A1353ADB2AF9ADBD231C572A1E5598A5F6BAA0C9FEF323755C9E92663F4B6B9C52B0633DCE4050D7AD7AF55627DDB446B18424254E6F50AD5A84F41D8831835992DC9A1934E22D62C4D28BB87852176C6347DA8C9088B43BA61E9D79DDB1AD4DE44E740F18C1F7FD570B721ED775E376CBBCD512F2E4DBB9317DD56310203010001"/>
    <PackageFile Name="Windows6.0-KB928439-x64.msu" HomeSite="ps10vistax64"
    PublicKey="3082010A0282010100D8DC95E9D1BA58324004219BF57E8C7581752EA5DD411D6AAD3D5E0DA7CEF775EBA20C1921B28669D291B3AE251B8060CA0B163CF8FEDF7A896A77D0F62BD8377AA7D3112E2DD7BE1895757B4239C28C27C258A031410EAEB94B44502450699167A9A1D56A5AA17E865B35C92A0314E16028515F45850075CC64D7ABB27C95A67A9E0C0A1353ADB2AF9ADBD231C572A1E5598A5F6BAA0C9FEF323755C9E92663F4B6B9C52B0633DCE4050D7AD7AF55627DDB446B18424254E6F50AD5A84F41D8831835992DC9A1934E22D62C4D28BB87852176C6347DA8C9088B43BA61E9D79DDB1AD4DE44E740F18C1F7FD570B721ED775E376CBBCD512F2E4DBB9317DD56310203010001"/>
    <PackageFile Name="WindowsXP-KB926139-v2-x86-ENU.exe" HomeSite="ps10xpx86"
    PublicKey="3082010a0282010100a2db0a8dcfc2c1499bcdaa3a34ad23596bdb6cbe2122b794c8eaaebfc6d526c232118bbcda5d2cfb36561e152bae8f0ddd14a36e284c7f163f41ac8d40b146880dd98194ad9706d05744765ceaf1fc0ee27f74a333cb74e5efe361a17e03b745ffd53e12d5b0ca5e0dd07bf2b7130dfc606a2885758cb7adbc85e817b490bef516b6625ded11df3aee215b8baf8073c345e3958977609be7ad77c1378d33142f13db62c9ae1aa94f9867add420393071e08d6746e2c61cf40d5074412fe805246a216b49b092c4b239c742a56d5c184aab8fd78e833e780a47d8a4b28423c3e2f27b66b14a74bd26414b9c6114604e30c882f3d00b707cee554d77d2085576810203010001"/>
    <PackageFile Name="WindowsServer2003.WindowsXP-KB926139-v2-x64-ENU.exe" HomeSite="ps10xpOrWin2003x64"
    PublicKey="3082010a0282010100a2db0a8dcfc2c1499bcdaa3a34ad23596bdb6cbe2122b794c8eaaebfc6d526c232118bbcda5d2cfb36561e152bae8f0ddd14a36e284c7f163f41ac8d40b146880dd98194ad9706d05744765ceaf1fc0ee27f74a333cb74e5efe361a17e03b745ffd53e12d5b0ca5e0dd07bf2b7130dfc606a2885758cb7adbc85e817b490bef516b6625ded11df3aee215b8baf8073c345e3958977609be7ad77c1378d33142f13db62c9ae1aa94f9867add420393071e08d6746e2c61cf40d5074412fe805246a216b49b092c4b239c742a56d5c184aab8fd78e833e780a47d8a4b28423c3e2f27b66b14a74bd26414b9c6114604e30c882f3d00b707cee554d77d2085576810203010001"/>
    <PackageFile Name="WindowsServer2003-KB926139-v2-x86-ENU.exe" HomeSite="ps10win2003x86"
    PublicKey="3082010a0282010100a2db0a8dcfc2c1499bcdaa3a34ad23596bdb6cbe2122b794c8eaaebfc6d526c232118bbcda5d2cfb36561e152bae8f0ddd14a36e284c7f163f41ac8d40b146880dd98194ad9706d05744765ceaf1fc0ee27f74a333cb74e5efe361a17e03b745ffd53e12d5b0ca5e0dd07bf2b7130dfc606a2885758cb7adbc85e817b490bef516b6625ded11df3aee215b8baf8073c345e3958977609be7ad77c1378d33142f13db62c9ae1aa94f9867add420393071e08d6746e2c61cf40d5074412fe805246a216b49b092c4b239c742a56d5c184aab8fd78e833e780a47d8a4b28423c3e2f27b66b14a74bd26414b9c6114604e30c882f3d00b707cee554d77d2085576810203010001"/>
    </PackageFiles>

    <InstallChecks>
    <RegistryCheck Property="PowershellInstalled" Key="HKLM\Software\Microsoft\PowerShell\1" Value="Install" />
    </InstallChecks>


    <!-- Defines how to invoke the setup for the Windows Powershell 1.0 redist -->
    <Commands Reboot="Immediate">
    <!-- Defines installation command for:
    Vista RTM and later
    Windows Server 2008 RTM and later
    on x86 platform -->
    <Command PackageFile="Windows6.0-KB928439-x86.msu"
    Arguments= "/quiet /norestart"
    EstimatedInstalledBytes="1768448"
    EstimatedInstallSeconds="450" >
    <InstallConditions>
    <BypassIf Property="PowershellInstalled" Compare="ValueEqualTo" Value="1" />
    <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel" />
    <BypassIf Property="VersionNT" Compare="VersionLessThan" Value="6.0" />
    <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform"/>
    <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
    </InstallConditions>
    <ExitCodes>
    <ExitCode Value="0" Result="Success"/>
    <ExitCode Value="1641" Result="SuccessReboot"/>
    <ExitCode Value="3010" Result="SuccessReboot"/>
    <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
    </ExitCodes>
    </Command>

    <!-- Defines installation command for:
    Vista RTM and later
    Windows Server 2008 RTM and later
    on x64 platform -->
    <Command PackageFile="Windows6.0-KB928439-x64.msu"
    Arguments= "/quiet /norestart"
    EstimatedInstalledBytes="3087360"
    EstimatedInstallSeconds="450" >
    <InstallConditions>
    <BypassIf Property="PowershellInstalled" Compare="ValueEqualTo" Value="1" />
    <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="amd64" />
    <BypassIf Property="VersionNT" Compare="VersionLessThan" Value="6.0" />
    <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform"/>
    <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
    </InstallConditions>
    <ExitCodes>
    <ExitCode Value="0" Result="Success"/>
    <ExitCode Value="1641" Result="SuccessReboot"/>
    <ExitCode Value="3010" Result="SuccessReboot"/>
    <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
    </ExitCodes>
    </Command>


    <!-- Defines installation command for:
    Windows XP Service Pack 2 and later
    on x86 platform -->
    <Command PackageFile="WindowsXP-KB926139-v2-x86-ENU.exe"
    Arguments= "/quiet /norestart"
    EstimatedInstalledBytes="3326976"
    EstimatedInstallSeconds="450" >
    <InstallConditions>
    <BypassIf Property="PowershellInstalled" Compare="ValueEqualTo" Value="1" />
    <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel" />
    <BypassIf Property="VersionNT" Compare="VersionGreaterThanOrEqualTo" Value="5.2.0" />
    <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform"/>
    <FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.1.2" String="InvalidPlatform"/>
    <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
    </InstallConditions>
    <ExitCodes>
    <ExitCode Value="0" Result="Success"/>
    <ExitCode Value="1641" Result="SuccessReboot"/>
    <ExitCode Value="3010" Result="SuccessReboot"/>
    <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
    </ExitCodes>
    </Command>

    <!-- Defines installation command for:
    Windows XP Service Pack 2 and later
    Windows 2003 Service Pack 1 or later
    on x64 platform -->
    <Command PackageFile="WindowsServer2003.WindowsXP-KB926139-v2-x64-ENU.exe"
    Arguments= "/quiet /norestart"
    EstimatedInstalledBytes="4684800"
    EstimatedInstallSeconds="450" >
    <InstallConditions>
    <BypassIf Property="PowershellInstalled" Compare="ValueEqualTo" Value="1" />
    <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="amd64" />
    <BypassIf Property="VersionNT" Compare="VersionGreaterThanOrEqualTo" Value="6.0"/>
    <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform"/>
    <FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.1.2" String="InvalidPlatform"/>
    <FailIf Property="VersionNT" Compare="VersionEqualTo" Value="5.2.0" String="InvalidPlatform"/>
    <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
    </InstallConditions>
    <ExitCodes>
    <ExitCode Value="0" Result="Success"/>
    <ExitCode Value="1641" Result="SuccessReboot"/>
    <ExitCode Value="3010" Result="SuccessReboot"/>
    <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
    </ExitCodes>
    </Command>


    <!-- Defines installation command for:
    Windows 2003 Service Pack 1 or later
    on x86 platform -->
    <Command PackageFile="WindowsServer2003-KB926139-v2-x86-ENU.exe"
    Arguments= "/quiet /norestart"
    EstimatedInstalledBytes="3053568"
    EstimatedInstallSeconds="450" >
    <InstallConditions>
    <BypassIf Property="PowershellInstalled" Compare="ValueEqualTo" Value="1" />
    <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel" />
    <BypassIf Property="VersionNT" Compare="VersionLessThan" Value="5.2.0"/>
    <BypassIf Property="VersionNT" Compare="VersionGreaterThanOrEqualTo" Value="6.0"/>
    <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform"/>
    <FailIf Property="VersionNT" Compare="VersionEqualTo" Value="5.2.0" String="InvalidPlatform"/>
    <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
    </InstallConditions>
    <ExitCodes>
    <ExitCode Value="0" Result="Success"/>
    <ExitCode Value="1641" Result="SuccessReboot"/>
    <ExitCode Value="3010" Result="SuccessReboot"/>
    <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
    </ExitCodes>
    </Command>


    </Commands>

    <Strings>

    <!-- Defines Homesite locations for each of the downloads -->
    <String Name="ps10vistax86">http://www.microsoft.com/downloads/details.aspx?FamilyID=c6ef4735-c7de-46a2-997a-ea58fdfcba63&displaylang=en&Hash=gFDYCnt0XHCZE8T4bgUP7awC7LOaLKHDhc6ARfmoFIDvb6Us%2fK7gcmW1kiq8adEqcY8gMdLa2LP4rYgftn0YEw%3d%3d</String>
    <String Name="ps10vistax64">http://www.microsoft.com/downloads/details.aspx?FamilyID=af37d87d-5de6-4af1-80f4-740f625cd084&displaylang=en&Hash=%2fRXyTFQ415GcjD7vRY1AnTFnsiEo2IfhO4XF5eCQ1wTWTGU8W9W%2fVD8qIfYSHJWyZX3YZo%2bN0xGHL5f6MwHfAQ%3d%3d</String>
    <String Name="ps10xpx86">http://download.microsoft.com/download/7/3/4/7345bb7d-0b07-40e8-9480-5b8c55b9c8b7/WindowsXP-KB926139-v2-x86-ENU.exe</String>
    <String Name="ps10xpWin2003x64">http://www.microsoft.com/downloads/thankyou.aspx?familyId=e9a90e13-c67c-42d7-b391-0e67dd67b83f&displayLang=en</String>
    <String Name="ps10win2003x86">http://download.microsoft.com/download/d/e/7/de7cb629-73a3-49cc-b796-50dfaaf1b833/WindowsServer2003-KB926139-v2-x86-ENU.exe</String>

    <!-- Defines a localizable string table for error messages-->
    <String Name="DisplayName">Windows Powershell 1.0</String>
    <String Name="Culture">en</String>
    <String Name="AdminRequired">Administrator permissions are required to install Windows Powershell 1.0. Contact your administrator.</String>
    <String Name="InvalidPlatform">Installation of Windows Powershell 1.0 requires Windows XP Service Pack 2 or later. Contact your application vendor.</String>
    <String Name="GeneralFailure">A failure occurred attempting to install Windows Powershell 1.0.</String>
    </Strings>

    </Package>


  5. Get the proper eula.rtf (I'm just a developer, you figure it out!) and save it to the en folder. The installer just needs the file to exist there to work.
  6. Download the necessary msu and exe files and save them into the 'Powershell1_0\en' folder.

To create the SQL Server 2008 Express Edition with Tools prerequisite:

  1. Create a new folder named 'SQLServer2008ExpressWithTools' under C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages
  2. In that new folder, create a file named 'product.xml'
    Save the following as the contents of that file:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- SQL Express 2008 VS Bootstrapper : package.xml : Language neutral information -->
    <Product xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" ProductCode="Microsoft.Sql.Server.ExpressWithTools.10.0">
    <RelatedProducts>
    <DependsOnProduct Code="Microsoft.Net.Framework.3.5.SP1" />
    <DependsOnProduct Code="Microsoft.Windows.Installer.4.5" />
    <DependsOnProduct Code="Microsoft.Windows.PowerShell.1.0" />
    <IncludesProduct Code="Microsoft.Sql.Server.Express.1.0" />
    <IncludesProduct Code="Microsoft.Sql.Server.Express.9.2" />
    </RelatedProducts>
    <PackageFiles CopyAllPackageFiles="false">
    <PackageFile Name="SqlExpressChk.exe" />
    </PackageFiles>
    <InstallChecks>
    <ExternalCheck Property="SQLExpressInstalled" PackageFile="SqlExpressChk.exe" />
    </InstallChecks>
    </Product>

  3. Create a new subfolder named 'en' under the 'SQLServer2008ExpressWithTools' folder
  4. In the 'en' folder, create a file named 'package.xml'
    Save the following as the contents of that file:

    <?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">
    <!--
    for 32-bit sql server w/ tools:
    md5 hash: CB1A8878ECC39B2F098AA1508CC94FC302C14516
    public key: 3082010A0282010100A2DB0A8DCFC2C1499BCDAA3A34AD23596BDB6CBE2122B794C8EAAEBFC6D526C232118BBCDA5D2CFB36561E152BAE8F0DDD14A36E284C7F163F41AC8D40B146880DD98194AD9706D05744765CEAF1FC0EE27F74A333CB74E5EFE361A17E03B745FFD53E12D5B0CA5E0DD07BF2B7130DFC606A2885758CB7ADBC85E817B490BEF516B6625DED11DF3AEE215B8BAF8073C345E3958977609BE7AD77C1378D33142F13DB62C9AE1AA94F9867ADD420393071E08D6746E2C61CF40D5074412FE805246A216B49B092C4B239C742A56D5C184AAB8FD78E833E780A47D8A4B28423C3E2F27B66B14A74BD26414B9C6114604E30C882F3D00B707CEE554D77D2085576810203010001
    -->


    <PackageFile Name="SQLEXPRWT_x86_ENU.EXE" HomeSite="SqlExpr32WTExe" PublicKey="3082010a0282010100a2db0a8dcfc2c1499bcdaa3a34ad23596bdb6cbe2122b794c8eaaebfc6d526c232118bbcda5d2cfb36561e152bae8f0ddd14a36e284c7f163f41ac8d40b146880dd98194ad9706d05744765ceaf1fc0ee27f74a333cb74e5efe361a17e03b745ffd53e12d5b0ca5e0dd07bf2b7130dfc606a2885758cb7adbc85e817b490bef516b6625ded11df3aee215b8baf8073c345e3958977609be7ad77c1378d33142f13db62c9ae1aa94f9867add420393071e08d6746e2c61cf40d5074412fe805246a216b49b092c4b239c742a56d5c184aab8fd78e833e780a47d8a4b28423c3e2f27b66b14a74bd26414b9c6114604e30c882f3d00b707cee554d77d2085576810203010001"/>
    <PackageFile Name="SQLEXPRWT_x64_ENU.EXE" HomeSite="SqlExpr64WTExe" PublicKey="3082010a0282010100a2db0a8dcfc2c1499bcdaa3a34ad23596bdb6cbe2122b794c8eaaebfc6d526c232118bbcda5d2cfb36561e152bae8f0ddd14a36e284c7f163f41ac8d40b146880dd98194ad9706d05744765ceaf1fc0ee27f74a333cb74e5efe361a17e03b745ffd53e12d5b0ca5e0dd07bf2b7130dfc606a2885758cb7adbc85e817b490bef516b6625ded11df3aee215b8baf8073c345e3958977609be7ad77c1378d33142f13db62c9ae1aa94f9867add420393071e08d6746e2c61cf40d5074412fe805246a216b49b092c4b239c742a56d5c184aab8fd78e833e780a47d8a4b28423c3e2f27b66b14a74bd26414b9c6114604e30c882f3d00b707cee554d77d2085576810203010001"/>
    <PackageFile Name="eula.rtf"/>
    </PackageFiles>

    <Commands Reboot="Defer">

    <!-- Defines a new installation (x86) -->
    <Command PackageFile="SQLEXPRWT_x86_ENU.EXE"
    Arguments='/q /hideconsole /action=Install /features=SQLEngine,SSMS /instancename=SQLEXPRESS /enableranu=1 /sqlsvcaccount="NT Authority\Network Service" /AddCurrentUserAsSqlAdmin /skiprules=RebootRequiredCheck'
    EstimatedInstalledBytes="225000000"
    EstimatedInstallSeconds="420">
    <InstallConditions>
    <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel"/>
    <BypassIf Property="SQLExpressInstalled" Compare="ValueNotEqualTo" Value="0"/>
    <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatformXP"/>
    <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"/>
    </InstallConditions>
    <ExitCodes>
    <ExitCode Value="0" Result="Success"/>
    <ExitCode Value="1641" Result="SuccessReboot"/>
    <ExitCode Value="3010" Result="SuccessReboot"/>
    <!-- 0x84BE0BC2 (1214,3010) -->
    <ExitCode Value="-2067919934" Result="FailReboot"/>
    <!-- 0x84C10BC2 (1217,3010) -->
    <ExitCode Value="-2067723326" Result="FailReboot"/>
    <!-- 0x84BE0007 (1214,7) -->
    <ExitCode Value="-2067922937" Result="Fail" String="AdminRequired"/>
    <!-- 0x84C4001F (1220,31) -->
    <ExitCode Value="-2067529697" Result="Fail" String="AdminRequired"/>
    <!-- 0x84BE0001 (1214,1)-->
    <ExitCode Value="-2067922943" Result="Fail" String="InvalidPlatformOSServicePacks"/>
    <!-- 0x84C4000B (1220,11) -->
    <ExitCode Value="-2067529717" Result="Fail" String="AnotherInstanceRunning"/>
    <!-- 0x84BE01F8 (1214,504) -->
    <ExitCode Value="-2067922440" Result="Fail" String="BetaComponentsFailure"/>
    <!-- 0x84BE01FA (1214,506) -->
    <ExitCode Value="-2067922438" Result="Fail" String="BetaComponentsFailure"/>
    <!-- 0x84BE0202 (1214,514) -->
    <ExitCode Value="-2067922430" Result="Fail" String="InvalidPlatformArchitecture"/>
    <!-- 0x84BE0203 (1214,515) -->
    <ExitCode Value="-2067922429" Result="Fail" String="InvalidPlatformArchitecture"/>
    <ExitCode Value="216" Result="Fail" String="InvalidPlatformArchitecture"/>
    <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
    </ExitCodes>
    </Command>

    <!-- Defines an upgrade installation (x86) -->
    <Command PackageFile="SQLEXPRWT_x86_ENU.EXE"
    Arguments="/q /hideconsole /action=Upgrade /instancename=SQLEXPRESS /skiprules=RebootRequiredCheck"
    EstimatedInstalledBytes="225000000"
    EstimatedInstallSeconds="420">
    <InstallConditions>
    <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel"/>
    <BypassIf Property="SQLExpressInstalled" Compare="ValueEqualTo" Value="0"/>
    <FailIf Property="SQLExpressInstalled" Compare="ValueLessThan" Value="0" String="GeneralFailure"/>
    <BypassIf Property="SQLExpressInstalled" Compare="ValueGreaterThanOrEqualTo" Value="10001600"/>
    <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatformXP"/>
    <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"/>
    </InstallConditions>
    <ExitCodes>
    <ExitCode Value="0" Result="Success"/>
    <ExitCode Value="1641" Result="SuccessReboot"/>
    <ExitCode Value="3010" Result="SuccessReboot"/>
    <!-- 0x84BE0BC2 (1214,3010) -->
    <ExitCode Value="-2067919934" Result="FailReboot"/>
    <!-- 0x84C10BC2 (1217,3010) -->
    <ExitCode Value="-2067723326" Result="FailReboot"/>
    <!-- 0x84BE0007 (1214,7) -->
    <ExitCode Value="-2067922937" Result="Fail" String="AdminRequired"/>
    <!-- 0x84C4001F (1220,31) -->
    <ExitCode Value="-2067529697" Result="Fail" String="AdminRequired"/>
    <!-- 0x84BE0001 (1214,1)-->
    <ExitCode Value="-2067922943" Result="Fail" String="InvalidPlatformOSServicePacks"/>
    <!-- 0x84C4000B (1220,11) -->
    <ExitCode Value="-2067529717" Result="Fail" String="AnotherInstanceRunning"/>
    <!-- 0x84BE01F8 (1214,504) -->
    <ExitCode Value="-2067922440" Result="Fail" String="BetaComponentsFailure"/>
    <!-- 0x84BE01FA (1214,506) -->
    <ExitCode Value="-2067922438" Result="Fail" String="BetaComponentsFailure"/>
    <!-- 0x84BE0202 (1214,514) -->
    <ExitCode Value="-2067922430" Result="Fail" String="InvalidPlatformArchitecture"/>
    <!-- 0x84BE0203 (1214,515) -->
    <ExitCode Value="-2067922429" Result="Fail" String="InvalidPlatformArchitecture"/>
    <ExitCode Value="216" Result="Fail" String="InvalidPlatformArchitecture"/>
    <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
    </ExitCodes>
    </Command>

    <!-- Defines a new installation (amd64) -->
    <Command PackageFile="SQLEXPRWT_x64_ENU.EXE"
    Arguments='/q /hideconsole /action=Install /features=SQLEngine,SSMS /instancename=SQLEXPRESS /enableranu=1 /sqlsvcaccount="NT Authority\Network Service" /AddCurrentUserAsSqlAdmin /skiprules=RebootRequiredCheck'
    EstimatedInstalledBytes="225000000"
    EstimatedInstallSeconds="420">
    <InstallConditions>
    <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="amd64"/>
    <BypassIf Property="SQLExpressInstalled" Compare="ValueNotEqualTo" Value="0"/>
    <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatformXP"/>
    <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"/>
    </InstallConditions>
    <ExitCodes>
    <ExitCode Value="0" Result="Success"/>
    <ExitCode Value="1641" Result="SuccessReboot"/>
    <ExitCode Value="3010" Result="SuccessReboot"/>
    <!-- 0x84BE0BC2 (1214,3010) -->
    <ExitCode Value="-2067919934" Result="FailReboot"/>
    <!-- 0x84C10BC2 (1217,3010) -->
    <ExitCode Value="-2067723326" Result="FailReboot"/>
    <!-- 0x84BE0007 (1214,7) -->
    <ExitCode Value="-2067922937" Result="Fail" String="AdminRequired"/>
    <!-- 0x84C4001F (1220,31) -->
    <ExitCode Value="-2067529697" Result="Fail" String="AdminRequired"/>
    <!-- 0x84BE0001 (1214,1)-->
    <ExitCode Value="-2067922943" Result="Fail" String="InvalidPlatformOSServicePacks"/>
    <!-- 0x84C4000B (1220,11) -->
    <ExitCode Value="-2067529717" Result="Fail" String="AnotherInstanceRunning"/>
    <!-- 0x84BE01F8 (1214,504) -->
    <ExitCode Value="-2067922440" Result="Fail" String="BetaComponentsFailure"/>
    <!-- 0x84BE01FA (1214,506) -->
    <ExitCode Value="-2067922438" Result="Fail" String="BetaComponentsFailure"/>
    <!-- 0x84BE0202 (1214,514) -->
    <ExitCode Value="-2067922430" Result="Fail" String="InvalidPlatformArchitecture"/>
    <!-- 0x84BE0203 (1214,515) -->
    <ExitCode Value="-2067922429" Result="Fail" String="InvalidPlatformArchitecture"/>
    <ExitCode Value="216" Result="Fail" String="InvalidPlatformArchitecture"/>
    <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
    </ExitCodes>
    </Command>

    <!-- Defines an upgrade installation (amd64) -->
    <Command PackageFile="SQLEXPRWT_x64_ENU.EXE"
    Arguments="/q /hideconsole /action=Upgrade /instancename=SQLEXPRESS /skiprules=RebootRequiredCheck"
    EstimatedInstalledBytes="225000000"
    EstimatedInstallSeconds="420">
    <InstallConditions>
    <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="amd64"/>
    <BypassIf Property="SQLExpressInstalled" Compare="ValueEqualTo" Value="0"/>
    <FailIf Property="SQLExpressInstalled" Compare="ValueLessThan" Value="0" String="GeneralFailure"/>
    <BypassIf Property="SQLExpressInstalled" Compare="ValueGreaterThanOrEqualTo" Value="10001600"/>
    <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatformXP"/>
    <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"/>
    </InstallConditions>
    <ExitCodes>
    <ExitCode Value="0" Result="Success"/>
    <ExitCode Value="1641" Result="SuccessReboot"/>
    <ExitCode Value="3010" Result="SuccessReboot"/>
    <!-- 0x84BE0BC2 (1214,3010) -->
    <ExitCode Value="-2067919934" Result="FailReboot"/>
    <!-- 0x84C10BC2 (1217,3010) -->
    <ExitCode Value="-2067723326" Result="FailReboot"/>
    <!-- 0x84BE0007 (1214,7) -->
    <ExitCode Value="-2067922937" Result="Fail" String="AdminRequired"/>
    <!-- 0x84C4001F (1220,31) -->
    <ExitCode Value="-2067529697" Result="Fail" String="AdminRequired"/>
    <!-- 0x84BE0001 (1214,1)-->
    <ExitCode Value="-2067922943" Result="Fail" String="InvalidPlatformOSServicePacks"/>
    <!-- 0x84C4000B (1220,11) -->
    <ExitCode Value="-2067529717" Result="Fail" String="AnotherInstanceRunning"/>
    <!-- 0x84BE01F8 (1214,504) -->
    <ExitCode Value="-2067922440" Result="Fail" String="BetaComponentsFailure"/>
    <!-- 0x84BE01FA (1214,506) -->
    <ExitCode Value="-2067922438" Result="Fail" String="BetaComponentsFailure"/>
    <!-- 0x84BE0202 (1214,514) -->
    <ExitCode Value="-2067922430" Result="Fail" String="InvalidPlatformArchitecture"/>
    <!-- 0x84BE0203 (1214,515) -->
    <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 Express Edition With Tools</String>
    <String Name="Culture">en</String>
    <String Name="SqlExpr32WTExe">http://download.microsoft.com/download/7/9/4/794bfafa-aea7-45d4-a6ea-4e92f09918e3/SQLEXPRWT_x86_ENU.exe</String>
    <String Name="SqlExpr64WTExe">http://download.microsoft.com/download/7/9/4/794bfafa-aea7-45d4-a6ea-4e92f09918e3/SQLEXPRWT_x64_ENU.exe</String>
    <String Name="AdminRequired">You do not have the permissions required to install SQL Server 2008 Express Edition. Please contact your administrator.</String>
    <String Name="GeneralFailure">An error occurred attempting to install SQL Server 2008 Express Edition.</String>
    <String Name="InvalidPlatformXP">Windows XP Service Pack 2 or later is required to install SQL Server 2008 Express Edition.</String>
    <String Name="InvalidPlatform2K3">Windows 2003 Service Pack 2 or later is required to install SQL Server 2008 Express Edition.</String>
    <String Name="MissingMSXml">SQL Server 2008 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 2008 Express Edition. Contact your application vendor.</String>
    <String Name="InvalidPlatformOSServicePacks">The current operating system does not meet Service Pack level requirements for SQL Server 2008 Express Edition. 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 Express Edition 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 components, SQL Server Support Files, or .NET Framework 2.0 before continuing.</String>
    <String Name="InvalidPlatformArchitecture">This version of SQL Server 2008 Express Edition is not supported for the current processor architecture.</String>
    </Strings>
    </Package>

  5. Get the proper eula.rtf (I'm just a developer, you figure it out!) and save it to the en folder. The installer just needs the file to exist there to work.



When setting SQL Server 2008 Express Edition with Tools as a prerequisite, be sure to also add Powershell 1.0! Otherwise the prereq install will fail.

Please let me know if this has helped you -- I know I pulled my hair out for a good two days before I decided to just sit down and do it.

Sunday, August 23, 2009

MSI - InstallUtil Failed for Web Application Install

If you are doing a web application install and you're passing the virtual directory via TARGETVDIR, make sure to NOT add the final \ as you would for TARGETDIR in your CustomActionData:


/tgt="[TARGETDIR]\" /vtgt="[TARGETVDIR]"

Launch executable from MSI created from VS.NET 2008

The project I'm on requires us to use only public domain compatible solutions, so purchasing InstallShield or using open source frameworks was out -- meaning I'm forced to use the built-in VS.NET 2008 Setup and Deployment.

I needed to give the user an option to launch the application after install, and after googling for hours, I never really came up with a good approach for my situation.

That is, until I came upon Aaron Stebner's blog entry. This was exactly what I needed. Note: if that link ever fails, google for "How can I customize an MSI in the Visual Studio setup/deployment project?" and look for the hit on blogs.msdn.com)

Essentially, you add a post-build event on your Setup project which calls out to a javascript file that manipulates the MSI. It adds the proper entries into the MSI database.

Here's my post-build event contents:


cscript.exe "$(ProjectDir)EnableLaunchApplication.js" "$(BuiltOuputPath)"


There are no typos in that -- "Ouput" is needed instead of "Output".

If you have one Setup project that includes another, there is one caveat: you need to run the script on both your target dir (bin) and the build dir (obj) since project references pull components from the obj dir and not the bin dir at build time.

Vista IIS 503 Service Unavailable

A lot of blogs mention the application pools not starting are a cause of this, but this wasn't my case. There was a url reservation for several subdirs under port 80 on my machine, and removing them fixed it.

To see if you have url reservations:

netsh http show urlacl


Look for anything touching port 80. (I had two -- /Temporary_Listen_Addresses/ and /wsman/). These need to be deleted before IIS can serve up content on port 80. For my case, I had to run:


netsh http delete urlacl http://+:80/Temporary_Listen_Addresses/


netsh http delete urlacl http://+:80/wsman/


After that, pulling up http://localhost/ worked as expected