Skip to content

Commit

Permalink
Merge pull request d365collaborative#814 from colind-work/invoke_sqlp…
Browse files Browse the repository at this point in the history
…ackage_fix

Also search %PATH% for sqlpackage.exe
  • Loading branch information
FH-Inway authored Mar 25, 2024
2 parents 5173c7a + a9de07f commit d137d94
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion d365fo.tools/internal/functions/invoke-sqlpackage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,22 @@ function Invoke-SqlPackage {

Invoke-TimeSignal -Start

if (!(Test-PathExists -Path $executable -Type Leaf)) { return }
if (!(Test-PathExists -Path $executable -Type Leaf)){
try{
$envSqlPackage = (Get-Command -Name "sqlpackage.exe").Source
if (!(Test-PathExists -Path $envSqlPackage -Type Leaf)) { return }
else{
$executable = $envSqlPackage
Set-D365SqlPackagePath -Path $executable
}
}
catch
{
# SqlPackage.exe is not in $Script:SqlPackagePath
# and not in %PATH%, so
return
}
}

Write-PSFMessage -Level Verbose -Message "Starting to prepare the parameters for sqlpackage.exe"

Expand Down

0 comments on commit d137d94

Please sign in to comment.