﻿<?xml version="1.0" encoding="utf-8"?>
<Product xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" ProductCode="Microsoft.SqlServer.SqlLocalDB.13.2">
  <InstallChecks>
    <FileCheck
      Property="sqllocaldbVersion"
      FileName="sqlservr.exe"
      SearchPath="Program Files\Microsoft SQL Server\130\LocalDB\Binn"
      SpecialFolder="WindowsVolume"
     />
  </InstallChecks>

  <PackageFiles CopyAllPackageFiles="false">
    <PackageFile
      Name="x64\sqllocaldb.msi"
      HomeSite="sqllocaldb_64"
			PublicKey="0"
     />
  </PackageFiles>

  <Commands Reboot="Defer">
    <Command PackageFile="x64\sqllocaldb.msi" Arguments="IACCEPTSQLLOCALDBLICENSETERMS=YES" EstimatedInstallSeconds="90">
      <InstallConditions>
        <BypassIf Property="sqllocaldbVersion" Compare="VersionGreaterThanOrEqualTo" Value="2015.131.5026.0"/>
        <!-- Block install on any platform other than x64 -->
        <FailIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="amd64" String="InvalidPlatformOS"/>
      </InstallConditions>

      <ExitCodes>
        <ExitCode Value="0" Result="Success" />
        <ExitCode Value="1641" Result="SuccessReboot" />
        <ExitCode Value="3010" Result="SuccessReboot" />
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>
    </Command>
  </Commands>
</Product>

