Skip to content

Commit f7e3842

Browse files
author
Ajay Kumar Yadav
authored
Added support for latest version of Data Tier application (#4835)
* Added support for latest version of Data Tier application * Review comment corrections
1 parent c7ab3a9 commit f7e3842

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

Tasks/SqlAzureDacpacDeployment/FindSqlPackagePath.ps1

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,46 @@ function Locate-HighestVersionSqlPackageWithSql()
181181

182182
function Locate-HighestVersionSqlPackageWithDacMsi()
183183
{
184+
$sqlDataTierFrameworkRegKeyWow = "HKLM:", "SOFTWARE", "Wow6432Node", "Microsoft", "Microsoft SQL Server", "Data-Tier Application Framework" -join [System.IO.Path]::DirectorySeparatorChar
185+
$sqlDataTierFrameworkRegKey = "HKLM:", "SOFTWARE", "Microsoft", "Microsoft SQL Server", "Data-Tier Application Framework" -join [System.IO.Path]::DirectorySeparatorChar
186+
187+
if (-not (Test-Path $sqlDataTierFrameworkRegKey))
188+
{
189+
$sqlDataTierFrameworkRegKey = $sqlDataTierFrameworkRegKeyWow
190+
}
191+
192+
if ((Test-Path $sqlDataTierFrameworkRegKey))
193+
{
194+
$keys = Get-Item $sqlDataTierFrameworkRegKey | %{$_.GetSubKeyNames()}
195+
$versions = Get-SubKeysInFloatFormat $keys | Sort-Object -Descending
196+
$installedMajorVersion = 0
197+
198+
foreach ($majorVersion in $versions)
199+
{
200+
$sqlInstallRootRegKey = "SOFTWARE", "Microsoft", "Microsoft SQL Server", "Data-Tier Application Framework", "$majorVersion" -join [System.IO.Path]::DirectorySeparatorChar
201+
$sqlInstallRootPath64 = Get-RegistryValueIgnoreError LocalMachine "$sqlInstallRootRegKey" "InstallDir" Registry64
202+
$sqlInstallRootPath32 = Get-RegistryValueIgnoreError LocalMachine "$sqlInstallRootRegKey" "InstallDir" Registry32
203+
if ($sqlInstallRootPath64 -ne $null)
204+
{
205+
$sqlInstallRootPath = $sqlInstallRootPath64
206+
break
207+
}
208+
if ($sqlInstallRootPath32 -ne $null)
209+
{
210+
$sqlInstallRootPath = $sqlInstallRootPath32
211+
break
212+
}
213+
}
214+
215+
$DacInstallPath = [System.IO.Path]::Combine($sqlInstallRootPath, "SqlPackage.exe")
216+
217+
if (Test-Path $DacInstallPath)
218+
{
219+
Write-Verbose "Dac Framework installed with SQL Version $majorVersion found at $DacInstallPath on machine $env:COMPUTERNAME"
220+
return $DacInstallPath, $majorVersion
221+
}
222+
}
223+
184224
$sqlRegKeyWow = "HKLM:", "SOFTWARE", "Wow6432Node", "Microsoft", "Microsoft SQL Server", "DACFramework", "CurrentVersion" -join [System.IO.Path]::DirectorySeparatorChar
185225
$sqlRegKey = "HKLM:", "SOFTWARE", "Microsoft", "Microsoft SQL Server", "DACFramework", "CurrentVersion" -join [System.IO.Path]::DirectorySeparatorChar
186226

Tasks/SqlAzureDacpacDeployment/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"version": {
1717
"Major": 1,
1818
"Minor": 1,
19-
"Patch": 18
19+
"Patch": 19
2020
},
2121
"demands": [
2222
"sqlpackage"

Tasks/SqlAzureDacpacDeployment/task.loc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"version": {
1717
"Major": 1,
1818
"Minor": 1,
19-
"Patch": 18
19+
"Patch": 19
2020
},
2121
"demands": [
2222
"sqlpackage"

0 commit comments

Comments
 (0)