We have an installation process that as part of the installation calls SqlPackage to compare a dacpac file against the database for that particular client, and updates any data changes.
The problem we have is that depending on the version of Sql Server and the version of SQL Server Data Tools, we have to pick the correct version of sqlpackage.exe to use.
The current process we use looks in the folder
C:\Program Files (x86)\Microsoft SQL Server\140\Dac\bin\ and loops down through 130, 120, 110 to find the highest available version
Unfortunately though, it is possible that the latest version can be installed in a Visual Studio subfolder
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\130
Is there any metadata that we can query to figure out what the existing highest version of SqlPackage is on a given server, and where it is to be found?