DrJohnT / AzureDevOpsExtensionsForSqlServer

Microsoft SQL Server deployment extensions for Azure DevOps Pipelines
MIT License
20 stars 14 forks source link

[BUG] Get-SqlPackagePath.ps1 does not find SqlPackage.exe if installed as part of a SQL Server installation #26

Closed zejji closed 3 years ago

zejji commented 3 years ago

For example, with a freshly installed installation of SQL Server 2017 on Windows Server 2019 using Chocolately, the correct location for SqlPackage.exe is:

C:\Program Files\Microsoft SQL Server\150\DAC\bin\SqlPackage.exe

This path (or the equivalent path for any other version of SQL Server - see here) is not searched as part of Get-SqlPackagePath.ps1.

The workaround appears to be to specify a 'CustomSqlPackageInstallLocation' environment variable, but the script would be more user-friendly if it searched all the default SQL Server install locations.

DrJohnT commented 3 years ago

@zejji
I upgraded the way the code works so that it covers more locations. I have now republished both the Azure DevOps extension where you changed the code and the source PowerShell gallery module (where your code changes should have gone!).

See https://marketplace.visualstudio.com/items?itemName=DrJohnExtensions.PublishDacPac https://www.powershellgallery.com/packages/PublishDacPac/

zejji commented 3 years ago

@DrJohnT - thank you, much appreciated!

zejji commented 3 years ago

Confirmed working correctly in our pipeline 👍