Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Also search %PATH% for sqlpackage.exe #95

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading