【问题标题】:How to add SQL Server 2014 in Prerequisites for Setup Wizard project如何在安装向导项目的先决条件中添加 SQL Server 2014
【发布时间】:2016-09-28 14:56:24
【问题描述】:

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

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

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

谢谢!

【问题讨论】:

    标签: sql-server


    【解决方案1】:

    这就是我的做法。可能需要进行一些更改以适应您的目的。此外,位置可能会根据您的机器配置略有不同。我有一个 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>
      

    完成后,重新启动 Visual Studio,您现在应该会看到 SQL Server 2014 Express 也列出了。

    【讨论】:

      猜你喜欢
      • 2015-04-18
      • 1970-01-01
      • 1970-01-01
      • 2012-06-01
      • 1970-01-01
      • 2023-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多