如何在安装向导项目的先决条件中添加SQL Server 2014

时间:2015-12-20 11:15:05

标签: sql-server

我创建了一个需要localDB的程序,我使用过SQL Server 2014.现在,当我尝试使用安装向导项目创建最终的可执行文件时,我无法设置为先决条件SQL Server 2014,我有只有SQL Server 2012:

enter image description here

问题是我尝试在Windows 7虚拟机中安装和使用该程序,但它不起作用,因为我收到的错误是"指定的LocalDB实例不存在"在cmd中,我只能创建v11 localDB实例。

如何在列表而不是SQL Server 2012中添加SQL Server作为先决条件?

谢谢!

1 个答案:

答案 0 :(得分:0)

我是这样做的。可能需要进行一些更改以满足您的目的。根据您的机器配置,位置也可能略有不同。我有一个64位Windows 10,并且正在为Visual Studio 2015做这个

  1. 找到SDK文件夹。对我来说是(C:\Program Files (x86)\Microsoft Visual Studio 14.0\SDK\Bootstrapper\Packages\

  2. 复制文件夹名称SqlExpress2012并将其命名为SqlExpress2014

  3. 打开product.xml并进行一些更改。以下是我做出更改后的情况 <?xml version="1.0" encoding="utf-8" ?> <Product xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" ProductCode="Microsoft.SqlServer.Express.12.0"> <RelatedProducts> <EitherProducts> <DependsOnProduct Code=".NETFramework,Version=v4.5" /> <DependsOnProduct Code=".NETFramework,Version=v4.0" /> </EitherProducts> <!-- Also depends on MSI4.5 or greater, which is included on all of the OS levels supported (see package.xml) --> <IncludesProduct Code="Microsoft.Sql.Server.Express.1.0" /> <IncludesProduct Code="Microsoft.Sql.Server.Express.9.2" /> <IncludesProduct Code="Microsoft.Sql.Server.Express.10.0" /> <IncludesProduct Code="Microsoft.SqlServer.Express.10.5" /> <IncludesProduct Code="Microsoft.SqlServer.Express.11.0" /> </RelatedProducts> <PackageFiles> <PackageFile Name="SqlExpressChk.exe" /> </PackageFiles> </Product>

  4. 下载并复制指定用于特定语言的文件夹中的相应文件(在我的情况下, en ) 您需要复制eula和两个设置文件(1个用于32位,其他用于64位)

  5. 完成后,在同一文件夹中打开package.xml文件并根据需要进行修改。以下是对我进行修改后的样子。

                     

           

    <!-- Defines a new installation (x86) -->
    <Command PackageFile="SQLEXPR32_x86_ENU.EXE"
         Arguments='/q /hideconsole /action=Install /features=SQL /instancename=SQLEXPRESS /enableranu=1 /AddCurrentUserAsSqlAdmin /IAcceptSqlServerLicenseTerms /skiprules=RebootRequiredCheck'
         EstimatedInstalledBytes="225000000"
         EstimatedInstallSeconds="420">
      <InstallConditions>
        <FailIf Property="VersionNT" Compare="ValueNotExists" String="InvalidPlatformOS"/>
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="6.0.0" String="InvalidPlatformOS"/>
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="6.0.2" String="InvalidPlatformOSServicePack"/>
        <FailIf Property="VersionNT" Compare="VersionEqualTo" Value="6.1.0" String="InvalidPlatformOSServicePack"/>
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
        <FailIf Property="SQLExpressChk" Compare="ValueEqualTo" Value="-1" String="InvalidUpgradeNotExpress"/>
        <FailIf Property="SQLExpressChk" Compare="ValueEqualTo" Value="-2" String="InvalidUpgradeNotExpressCore"/>
        <FailIf Property="SQLExpressChk" Compare="ValueEqualTo" Value="-3" String="InvalidUpgradeLanguage"/>
        <FailIf Property="SQLExpressChk" Compare="ValueEqualTo" Value="-4" String="InvalidUpgradeWoW"/>
        <FailIf Property="SQLExpressChk" Compare="ValueLessThan" Value="-4" String="GeneralFailure"/>
        <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel"/>
        <BypassIf Property="SQLExpressChk" Compare="ValueNotEqualTo" Value="1"/>
      </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="InvalidPlatformOSServicePack"/>
        <!-- 0x84C4000E (1220,14) -->
        <ExitCode Value="-2067529714" Result="Fail" String="InvalidPlatformOSLanguage"/>
        <!-- 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="SQLEXPR32_x86_ENU.EXE"
         Arguments="/q /hideconsole /action=Upgrade /instancename=SQLEXPRESS /IAcceptSqlServerLicenseTerms /skiprules=RebootRequiredCheck"
         EstimatedInstalledBytes="225000000"
         EstimatedInstallSeconds="420">
      <InstallConditions>
        <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel"/>
        <BypassIf Property="SQLExpressChk" Compare="ValueNotEqualTo" Value="2"/>
      </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="InvalidPlatformOSServicePack"/>
        <!-- 0x84C4000E (1220,14) -->
        <ExitCode Value="-2067529714" Result="Fail" String="InvalidPlatformOSLanguage"/>
        <!-- 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=SQL /instancename=SQLEXPRESS /enableranu=1 /AddCurrentUserAsSqlAdmin /IAcceptSqlServerLicenseTerms /skiprules=RebootRequiredCheck'
         EstimatedInstalledBytes="225000000"
         EstimatedInstallSeconds="420">
      <InstallConditions>
        <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="amd64"/>
        <BypassIf Property="SQLExpressChk" Compare="ValueNotEqualTo" Value="1"/>
      </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="InvalidPlatformOSServicePack"/>
        <!-- 0x84C4000E (1220,14) -->
        <ExitCode Value="-2067529714" Result="Fail" String="InvalidPlatformOSLanguage"/>
        <!-- 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="SQLEXPR_x64_ENU.EXE"
         Arguments="/q /hideconsole /action=Upgrade /instancename=SQLEXPRESS /IAcceptSqlServerLicenseTerms /skiprules=RebootRequiredCheck"
         EstimatedInstalledBytes="225000000"
         EstimatedInstallSeconds="420">
      <InstallConditions>
        <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="amd64"/>
        <BypassIf Property="SQLExpressChk" Compare="ValueNotEqualTo" Value="2"/>
      </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="InvalidPlatformOSServicePack"/>
        <!-- 0x84C4000E (1220,14) -->
        <ExitCode Value="-2067529714" Result="Fail" String="InvalidPlatformOSLanguage"/>
        <!-- 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>
    

    <Strings>
        <String Name="DisplayName">SQL Server 2014 Express</String>
        <String Name="Culture">en</String>
        <String Name="SqlExpr32Exe">http://go.microsoft.com/fwlink/?LinkID=230852&amp;clcid=0x409</String>
        <String Name="SqlExpr64Exe">http://go.microsoft.com/fwlink/?LinkID=230853&amp;clcid=0x409</String>
        <String Name="AdminRequired">You do not have the permissions required to install SQL Server 2014 Express. Please contact your administrator.</String>
        <String Name="GeneralFailure">An error occurred attempting to install SQL Server 2014 Express.</String>
        <String Name="InvalidPlatformOS">The current operating system version does not support SQL Server 2014 Express.</String>
        <String Name="InvalidPlatformOSServicePack">The current operating system does not meet Service Pack level requirements for SQL Server 2014 Express. Install the most recent Service Pack from the Microsoft download center at http://www.microsoft.com/downloads before continuing setup.</String>
        <String Name="InvalidPlatformOSLanguage">The English version of SQL Server 2014 Express can only be installed on a Windows operating system of the same language.</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 or SQL Server was detected on the computer. Uninstall any previous beta versions of SQL Server 2014 components, SQL Server Support Files, or .NET Framework before continuing.</String>
        <String Name="InvalidPlatformArchitecture">This version of SQL Server 2014 Express is not supported for the current processor architecture.</String>
        <String Name="InvalidUpgradeNotExpress">The instance of SQL Server named 'SQLEXPRESS' is a not an instance of SQL Server Express. It cannot be upgraded to SQL Server 2014 Express.</String>
        <String Name="InvalidUpgradeNotExpressCore">The instance of SQL Server Express named 'SQLEXPRESS' contains components that are not included in SQL Server 2014 Express. SQL Server 2014 Express cannot upgrade this instance. Please use SQL Server 2014 Express with Advanced Services instead.</String>
        <String Name="InvalidUpgradeLanguage">The instance of SQL Server Express named 'SQLEXPRESS' is a different language version than this SQL Server 2014 Express. SQL Server 2014 Express cannot upgrade this instance.</String>
        <String Name="InvalidUpgradeWoW">SQL Server 2014 Express (x64) cannot upgrade the existing instance of SQL Server Express (x64 WoW) named 'SQLEXPRESS'. Uninstall this instance of SQL Server Express and retry installing SQL Server 2014 Express (x64).</String>
    </Strings>
    

  6. 完成后,重新启动visual Studio,您现在也应该看到SQL Server 2014 Express。