Hello,I've created an application in .NET which uses SQL Express 2008. The plan is to install this application using a Setup project in VS2008. I managed to create the application setup with SQL and .NET 3.5 SP1 included as prerequisites and the application installs successfully on a "fresh" VM (nothing installed prior). What I need right now is: * detect somehow if the instance I'm trying to install already exists and skip this step; right now if I attempt a 2nd installation, the installer will crash (will post the contents of the log file at the end of the post). I'm guessing this is because I removed an install condition from the boostrapper package.xml file and that is<BypassIf Property="SQLExpressInstalled" Compare="ValueNotEqualTo" Value="0"/>
If I don't remove this, my instance will not be installed if there's another instance installed prior to that. * include a custom action that will run a script which creates a database; I have everything set up here but I'm getting a vague "Transact SQL error". I've tried two methods: running the script with ExecuteNonQuery() and using Database.Create() (Microsoft.SqlServer.Smo namespace). The said script runs without hitch in Management Studio so I'm guessing it's a permission issue, because it connects to the instance but it won't run the script. I tried connecting both with "sa" and default credentials, same result.Been racking my brains here for 2 days filled with research and trial-and-error so I'm asking if someone has done this before, please post the steps I should take. Note that I've tried with SQL express 2005 as well, which will skip the installation if the instance is already there by itself, but won't execute the script either.Thanks.Contents of the installation log of SQL express 2008:The following properties have been set:Property: [AdminUser] = true {boolean}Property: [ProcessorArchitecture] = Intel {string}Property: [VersionNT] = 5.1.3 {version}Running checks for package 'Windows Installer 3.1', phase BuildListThe following properties have been set for package 'Windows Installer 3.1':Running checks for command 'WindowsInstaller3_1\WindowsInstaller-KB893803-v2-x86.exe'Result of running operator 'VersionGreaterThanOrEqualTo' on property 'VersionMsi' and value '3.1': trueResult of checks for command 'WindowsInstaller3_1\WindowsInstaller-KB893803-v2-x86.exe' is 'Bypass''Windows Installer 3.1' RunCheck result: No Install NeededRunning checks for package '.NET Framework 3.5 SP1', phase BuildListReading value 'SP' of registry key 'HKLM\Software\Microsoft\NET Framework Setup\NDP\v3.5'Read integer value 1Setting value '1 {int}' for property 'DotNet35SP'The following properties have been set for package '.NET Framework 3.5 SP1':Property: [DotNet35SP] = 1 {int}Running checks for command 'DotNetFX35SP1\dotNetFx35setup.exe'Result of running operator 'ValueGreaterThanEqualTo' on property 'DotNet35SP' and value '1': trueResult of checks for command 'DotNetFX35SP1\dotNetFx35setup.exe' is 'Bypass''.NET Framework 3.5 SP1' RunCheck result: No Install NeededRunning checks for package 'Windows Installer 4.5', phase BuildListThe following properties have been set for package 'Windows Installer 4.5':Running checks for command 'WindowsInstaller4_5\Windows6.0-KB942288-v2-x86.MSU'Result of running operator 'VersionGreaterThanOrEqualTo' on property 'VersionMsi' and value '4.5': trueResult of checks for command 'WindowsInstaller4_5\Windows6.0-KB942288-v2-x86.MSU' is 'Bypass'Running checks for command 'WindowsInstaller4_5\WindowsXP-KB942288-v3-x86.exe'Result of running operator 'VersionGreaterThanOrEqualTo' on property 'VersionMsi' and value '4.5': trueResult of checks for command 'WindowsInstaller4_5\WindowsXP-KB942288-v3-x86.exe' is 'Bypass'Running checks for command 'WindowsInstaller4_5\WindowsServer2003-KB942288-v4-x86.exe'Result of running operator 'VersionGreaterThanOrEqualTo' on property 'VersionMsi' and value '4.5': trueResult of checks for command 'WindowsInstaller4_5\WindowsServer2003-KB942288-v4-x86.exe' is 'Bypass'Running checks for command 'WindowsInstaller4_5\Windows6.0-KB942288-v2-x64.MSU'Result of running operator 'VersionGreaterThanOrEqualTo' on property 'VersionMsi' and value '4.5': trueResult of checks for command 'WindowsInstaller4_5\Windows6.0-KB942288-v2-x64.MSU' is 'Bypass'Running checks for command 'WindowsInstaller4_5\WindowsServer2003-KB942288-v4-x64.exe'Result of running operator 'VersionGreaterThanOrEqualTo' on property 'VersionMsi' and value '4.5': trueResult of checks for command 'WindowsInstaller4_5\WindowsServer2003-KB942288-v4-x64.exe' is 'Bypass'Running checks for command 'WindowsInstaller4_5\Windows6.0-KB942288-v2-ia64.MSU'Result of running operator 'VersionGreaterThanOrEqualTo' on property 'VersionMsi' and value '4.5': trueResult of checks for command 'WindowsInstaller4_5\Windows6.0-KB942288-v2-ia64.MSU' is 'Bypass'Running checks for command 'WindowsInstaller4_5\WindowsServer2003-KB942288-v4-ia64.exe'Result of running operator 'VersionGreaterThanOrEqualTo' on property 'VersionMsi' and value '4.5': trueResult of checks for command 'WindowsInstaller4_5\WindowsServer2003-KB942288-v4-ia64.exe' is 'Bypass''Windows Installer 4.5' RunCheck result: No Install NeededRunning checks for package 'SQL Server 2008 Express Edition - SomeInstance', phase BuildListRunning external check with command 'C:\DOCUME~1\alex\LOCALS~1\Temp\VSD256.tmp\SqlExpress2008 - SomeInstance\SqlExpressChk.exe' and parameters ''Process exited with code 0Setting value '0 {int}' for property 'SQLExpressInstalled'The following properties have been set for package 'SQL Server 2008 Express Edition - SomeInstance':Property: [SQLExpressInstalled] = 0 {int}Running checks for command 'SqlExpress2008 - SomeInstance\SQLEXPR32_x86_ENU.EXE'Result of running operator 'ValueNotEqualTo' on property 'ProcessorArchitecture' and value 'Intel': falseResult of running operator 'ValueExists' on property 'Version9x': falseResult of running operator 'VersionLessThan' on property 'VersionNT' and value '5.1.2': falseResult of running operator 'VersionEqualTo' on property 'VersionNT' and value '5.2.0': falseResult of running operator 'VersionEqualTo' on property 'VersionNT' and value '5.2.1': falseResult of running operator 'ValueEqualTo' on property 'AdminUser' and value 'false': falseResult of checks for command 'SqlExpress2008 - SomeInstance\SQLEXPR32_x86_ENU.EXE' is 'Install'Running checks for command 'SqlExpress2008 - SomeInstance\SQLEXPR_x64_ENU.EXE'Result of running operator 'ValueNotEqualTo' on property 'ProcessorArchitecture' and value 'amd64': trueResult of checks for command 'SqlExpress2008 - SomeInstance\SQLEXPR_x64_ENU.EXE' is 'Bypass''SQL Server 2008 Express Edition - SomeInstance' RunCheck result: Install NeededEULA for components 'SQL Server 2008 Express Edition - SomeInstance' was accepted.Copying files to temporary directory "C:\DOCUME~1\alex\LOCALS~1\Temp\VSD256.tmp\"Copying from 'C:\Documents and Settings\alex\Desktop\arenda\SqlExpress2008 - SomeInstance\SQLEXPR32_x86_ENU.EXE' to 'C:\DOCUME~1\alex\LOCALS~1\Temp\VSD256.tmp\SqlExpress2008 - SomeInstance\SQLEXPR32_x86_ENU.EXE'Verifying file integrity of C:\DOCUME~1\alex\LOCALS~1\Temp\VSD256.tmp\SqlExpress2008 - SomeInstance\SQLEXPR32_x86_ENU.EXEWinVerifyTrust returned 0File trustedRunning checks for package 'SQL Server 2008 Express Edition - SomeInstance', phase BeforePackageRunning external check with command 'C:\DOCUME~1\alex\LOCALS~1\Temp\VSD256.tmp\SqlExpress2008 - SomeInstance\SqlExpressChk.exe' and parameters ''Process exited with code 0Setting value '0 {int}' for property 'SQLExpressInstalled'The following properties have been set for package 'SQL Server 2008 Express Edition - SomeInstance':Property: [SQLExpressInstalled] = 0 {int}Running checks for command 'SqlExpress2008 - SomeInstance\SQLEXPR32_x86_ENU.EXE'Result of running operator 'ValueNotEqualTo' on property 'ProcessorArchitecture' and value 'Intel': falseResult of running operator 'ValueExists' on property 'Version9x': falseResult of running operator 'VersionLessThan' on property 'VersionNT' and value '5.1.2': falseResult of running operator 'VersionEqualTo' on property 'VersionNT' and value '5.2.0': falseResult of running operator 'VersionEqualTo' on property 'VersionNT' and value '5.2.1': falseResult of running operator 'ValueEqualTo' on property 'AdminUser' and value 'false': falseResult of checks for command 'SqlExpress2008 - SomeInstance\SQLEXPR32_x86_ENU.EXE' is 'Install''SQL Server 2008 Express Edition - SomeInstance' RunCheck result: Install NeededVerifying file integrity of C:\DOCUME~1\alex\LOCALS~1\Temp\VSD256.tmp\SqlExpress2008 - SomeInstance\SQLEXPR32_x86_ENU.EXEWinVerifyTrust returned 0File trustedInstalling using command 'C:\DOCUME~1\alex\LOCALS~1\Temp\VSD256.tmp\SqlExpress2008 - SomeInstance\SQLEXPR32_x86_ENU.EXE' and parameters '/q /hideconsole /action=Install /features=SQLEngine /instancename=SomeInstance /enableranu=1 /sqlsvcaccount="NT Authority\Network Service" /AddCurrentUserAsSqlAdmin /skiprules=RebootRequiredCheck /TCPENABLED=1 /SECURITYMODE=SQL /SAPWD=access /SQLSVCSTARTUPTYPE=Automatic /ERRORREPORTING=False /SQMREPORTING=False'Process exited with code -2068643838Status of package 'SQL Server 2008 Express Edition - SomeInstance' after install is 'InstallFailed'
Contents of the bootstrapper package.xml 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"> <PackageFile Name="SQLEXPR32_x86_ENU.EXE" HomeSite="SqlExpr32Exe" PublicKey="3082010a0282010100a2db0a8dcfc2c1499bcdaa3a34ad23596bdb6cbe2122b794c8eaaebfc6d526c232118bbcda5d2cfb36561e152bae8f0ddd14a36e284c7f163f41ac8d40b146880dd98194ad9706d05744765ceaf1fc0ee27f74a333cb74e5efe361a17e03b745ffd53e12d5b0ca5e0dd07bf2b7130dfc606a2885758cb7adbc85e817b490bef516b6625ded11df3aee215b8baf8073c345e3958977609be7ad77c1378d33142f13db62c9ae1aa94f9867add420393071e08d6746e2c61cf40d5074412fe805246a216b49b092c4b239c742a56d5c184aab8fd78e833e780a47d8a4b28423c3e2f27b66b14a74bd26414b9c6114604e30c882f3d00b707cee554d77d2085576810203010001"/> <PackageFile Name="SQLEXPR_x64_ENU.EXE" HomeSite="SqlExpr64Exe" PublicKey="3082010a0282010100a2db0a8dcfc2c1499bcdaa3a34ad23596bdb6cbe2122b794c8eaaebfc6d526c232118bbcda5d2cfb36561e152bae8f0ddd14a36e284c7f163f41ac8d40b146880dd98194ad9706d05744765ceaf1fc0ee27f74a333cb74e5efe361a17e03b745ffd53e12d5b0ca5e0dd07bf2b7130dfc606a2885758cb7adbc85e817b490bef516b6625ded11df3aee215b8baf8073c345e3958977609be7ad77c1378d33142f13db62c9ae1aa94f9867add420393071e08d6746e2c61cf40d5074412fe805246a216b49b092c4b239c742a56d5c184aab8fd78e833e780a47d8a4b28423c3e2f27b66b14a74bd26414b9c6114604e30c882f3d00b707cee554d77d2085576810203010001"/> <PackageFile Name="eula.rtf"/> </PackageFiles> <Commands Reboot="Defer"> <!-- Defines a new installation (x86) --> <Command PackageFile="SQLEXPR32_x86_ENU.EXE" Arguments='/q /hideconsole /action=Install /features=SQLEngine /instancename=SomeInstance /enableranu=1 /sqlsvcaccount="NT Authority\Network Service" /AddCurrentUserAsSqlAdmin /skiprules=RebootRequiredCheck /TCPENABLED=1 /SECURITYMODE=SQL /SAPWD=access /SQLSVCSTARTUPTYPE=Automatic /ERRORREPORTING=False /SQMREPORTING=False' EstimatedInstalledBytes="225000000" EstimatedInstallSeconds="420"> <InstallConditions> <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel"/> <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="SQLEXPR_x64_ENU.EXE" Arguments='/q /hideconsole /action=Install /features=SQLEngine /instancename=SomeInstance /enableranu=1 /sqlsvcaccount="NT Authority\Network Service" /AddCurrentUserAsSqlAdmin /skiprules=RebootRequiredCheck /TCPENABLED=1 /SECURITYMODE=SQL /SAPWD=access /SQLSVCSTARTUPTYPE=Automatic /ERRORREPORTING=False /SQMREPORTING=False' EstimatedInstalledBytes="225000000" EstimatedInstallSeconds="420"> <InstallConditions> <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="amd64"/> <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 - SomeInstance</String> <String Name="Culture">en</String> <String Name="SqlExpr32Exe">http://go.microsoft.com/fwlink/?LinkID=108368&clcid=0x409</String> <String Name="SqlExpr64Exe">http://go.microsoft.com/fwlink/?LinkID=110382&clcid=0x409</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>