2015-12-20 93 views
1

我創建了一個需要localDB的程序,並且我已經使用了SQL Server 2014.現在,當我嘗試使用安裝嚮導項目創建最終的可執行文件時,設置爲前提的SQL Server 2014年,我只有SQL Server 2012中:如何在安裝嚮導項目的先決條件中添加SQL Server 2014

enter image description here

的問題是,我試圖安裝在Windows 7虛擬機使用的程序,它不工作,因爲我得到「指定的LocalDB實例不存在」的錯誤,並且在cmd中我只能創建v11 localDB實例。

如何添加SQL Server作爲列表中的先決條件而不是SQL Server 2012?

謝謝!

回答

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> 
    

完成後,重新啓動Visual Studio和你現在應該看到的SQL Server 2014點快速列出。

相關問題