ClickOnce先决条件:SQL Server Express 2014 LocalDB在哪里?

问题描述:

我正在从Visual Studio 2013社区版中为我的wpf应用程序创建一个clickonce安装程序.此应用程序使用localdb.如果我手动安装sqlserver express 2014 LocalDB,则在目标计算机上运行良好.

I am creating a clickonce installer for my wpf application from within Visual Studio 2013 Community edition. This application uses a localdb. It works fine on the target machines if I manually install sqlserver express 2014 LocalDB.

但是我想在我的clickonce部署中包括SQL Server Express 2014 LocalDB的安装程序.

But I would like to include the installer for SQL Server Express 2014 LocalDB with my clickonce deployment.

但是,当我打开先决条件对话框时,仅SQL Server 2012 Express LocalDB可用(参见图片).我尝试选择'2012,但与我的安装程序放入数据文件夹的mdf文件不兼容.

When I open the prerequisites dialog, however, only SQL Server 2012 Express LocalDB is available (see image). I tried selecting '2012, but it is not compatible with the mdf file my installer drops into the data folder.

问题是:如何将SQL Server Express 2014 LocalDB安装程序作为先决条件?是否可以将MSI文件拖放到某个位置并使其正常工作?还是坚持使用"2012年"会更容易?

The question is: How do I include the SQL Server Express 2014 LocalDB installer as a prerequisite? Is there a way to just drop the MSI file somewhere and make it work? Or will it be easier to stick with '2012?

我在

As I posted on the MSDN forums I created my own package as an official version doesn't exist. The package is basically just a copy of the SqlLocalDB2012 package updated to point to the new version of msi files to download.

我已将boostrapper软件包的所有文件放在 GitHub 上,因此人们不必创建文件他们自己.有两个版本,一个用于原始版本,一个用于SP1版本.以下是自行创建原始发行版的步骤:

I've put all the files for the boostrapper package on GitHub so people don't have to create the files themselves. There's two versions, one for the original release and one for the SP1 release. Following are the steps to create the original release version yourself:

  1. 创建文件夹SqlLocalDB2014
  2. 在名为product.xml的文件夹中创建一个具有以下内容的xml文件:

  1. Create a folder SqlLocalDB2014
  2. Create an xml file in the folder called product.xml with the following contents:

<?xml version="1.0" encoding="utf-8"?>
<Product xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" ProductCode="Microsoft.SqlServer.SqlLocalDB.12.0">
  <InstallChecks>
    <FileCheck
      Property="sqllocaldbVersion"
      FileName="sqlservr.exe"
      SearchPath="Microsoft SQL Server\120\LocalDB\Binn"
      SpecialFolder="ProgramFilesFolder"
    />
  </InstallChecks>

  <PackageFiles CopyAllPackageFiles="false">
    <PackageFile
      Name="x86\sqllocaldb.msi"
      HomeSite="sqllocaldb_32"
      PublicKey="3082010A0282010100E57C2F2D0CA9EC7AA834E04C3F7F490E0DB615AD1913DE528A26991571A962270737A5833082626C0BA3FD060D171406E6E0ADCC95960A205AA296E1E057303C5D629BC55D890CD034DFD9D8FA35EF11238BC0F9EB4AF439DA2F7110EB11B32C37A370E886173EEF2A46D08EC7B94800A137F1C7C8E7D21E6B4A2AF2C64C1D709F7CC368428E3CED811A52E33E32943D7E18F19BE44B5C11E4D6C3851E6C033073BCC9A8017D9DADD1F573F05B1A7B2F1F8B32BEB38EB53BD9F7FFF35FB3137C139357B8A05E359883A13434F2C5049FB9FE46170C91DFEF0F55F6ECCC39C96165A129EEBE11371BB76E4255C9CC35D152B303709C98349E2936A917195F0BBF0203010001"
    />
    <PackageFile
      Name="x64\sqllocaldb.msi"
      HomeSite="sqllocaldb_64"
      PublicKey="3082010A0282010100E57C2F2D0CA9EC7AA834E04C3F7F490E0DB615AD1913DE528A26991571A962270737A5833082626C0BA3FD060D171406E6E0ADCC95960A205AA296E1E057303C5D629BC55D890CD034DFD9D8FA35EF11238BC0F9EB4AF439DA2F7110EB11B32C37A370E886173EEF2A46D08EC7B94800A137F1C7C8E7D21E6B4A2AF2C64C1D709F7CC368428E3CED811A52E33E32943D7E18F19BE44B5C11E4D6C3851E6C033073BCC9A8017D9DADD1F573F05B1A7B2F1F8B32BEB38EB53BD9F7FFF35FB3137C139357B8A05E359883A13434F2C5049FB9FE46170C91DFEF0F55F6ECCC39C96165A129EEBE11371BB76E4255C9CC35D152B303709C98349E2936A917195F0BBF0203010001"
    />
  </PackageFiles>

  <Commands Reboot="Defer">
    <Command PackageFile="x86\sqllocaldb.msi" Arguments="IACCEPTSQLLOCALDBLICENSETERMS=YES" EstimatedInstallSeconds="90">
      <InstallConditions>
        <FailIf Property="VersionNT" Compare="ValueNotExists" String="InvalidPlatformOS" />
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="6.0.1" String="InvalidPlatformOS" />
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired" />
        <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel" />
        <BypassIf Property="sqllocaldbVersion" Compare="VersionGreaterThanOrEqualTo" Value="2014.120.2000.8" />
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success" />
        <ExitCode Value="1641" Result="SuccessReboot" />
        <ExitCode Value="3010" Result="SuccessReboot" />
        <DefaultExitCode Result="Fail" String="GeneralFailure" FormatMessageFromSystem="true" />
      </ExitCodes>
    </Command>
    <Command PackageFile="x64\sqllocaldb.msi" Arguments="IACCEPTSQLLOCALDBLICENSETERMS=YES" EstimatedInstallSeconds="90">
      <InstallConditions>
        <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="amd64" />
        <BypassIf Property="sqllocaldbVersion" Compare="VersionGreaterThanOrEqualTo" Value="2014.120.2000.8" />
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success" />
        <ExitCode Value="1641" Result="SuccessReboot" />
        <ExitCode Value="3010" Result="SuccessReboot" />
        <DefaultExitCode Result="Fail" String="GeneralFailure" FormatMessageFromSystem="true" />
      </ExitCodes>
    </Command>
  </Commands>
</Product>

  • 在该文件夹中,创建另一个名为en的文件夹,并创建另一个名为package.xml

  • Within the folder create another folder called en and create another xml file called package.xml

     <?xml version="1.0" encoding="utf-8"?>
     <Package Name="DisplayName" LicenseAgreement="Eula.txt" Culture="Culture" xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper">
       <PackageFiles>
         <PackageFile Name="Eula.txt" />
       </PackageFiles>
       <Strings>
         <String Name="Culture">en</String>
         <String Name="DisplayName">SQL Server 2014 Express LocalDB</String>
         <String Name="sqllocaldb_32">http://download.microsoft.com/download/E/A/E/EAE6F7FC-767A-4038-A954-49B8B05D04EB/LocalDB%2032BIT/SqlLocalDB.msi</String>
         <String Name="sqllocaldb_64">http://download.microsoft.com/download/E/A/E/EAE6F7FC-767A-4038-A954-49B8B05D04EB/LocalDB%2064BIT/SqlLocalDB.msi</String>
         <String Name="AdminRequired">You do not have the permissions required to install SQL Server 2014 Express LocalDB. Please contact your administrator.</String>
         <String Name="GeneralFailure">An error occurred attempting to install SQL Server 2014 Express LocalDB.</String>
         <String Name="InvalidPlatformOS">The current operating system version does not support SQL Server 2014 Express LocalDB.</String>
         <String Name="InvalidPlatformOSServicePack">The current operating system does not meet Service Pack level requirements for SQL Server 2014 Express LocalDB. Install the most recent Service Pack from the Microsoft download center at http://www.microsoft.com/downloads before continuing setup.</String>
       </Strings>
     </Package>
    

  • C:\Program Files\Microsoft SQL Server\120\License Terms\License_SqlLocalDB_1033.txt文件复制到en文件夹中,并将其重命名为eula.txt.

  • Copy the C:\Program Files\Microsoft SQL Server\120\License Terms\License_SqlLocalDB_1033.txt file into the en folder and rename it to eula.txt.