Find Sqlpackage.exe on client machine to install D

2019-06-24 19:20发布

I'm developing a .Net-application that would deploy a dacpac on a client machine. For that purpose I would require SqlPackage.exe to deploy the dacpac. I need a absolute path of SqlPackage.exe to make my application work irrespective of client's machine configuration.

Can you please help me to achieve this.

Thanks, Yogesh

标签: c# .net dacpac
2条回答
叛逆
2楼-- · 2019-06-24 19:51

To find sqlpackage programmatically you can make use of the TaskModuleSqlUtility powershell library. Either run the Invoke-DacpacDeployment from the powershell script (sorry not C#) or make use of Get-SqlPackageOnTargetMachine function for sqlpackage.exe path.

Search for tests in github for samples.

查看更多
放荡不羁爱自由
3楼-- · 2019-06-24 19:58

You can install sqlpackage.exe in two ways:

  • SSDT (SQL Server Data Tools): the location will be VS Install Directory\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\{SqlVersion}, VS install directory: C:\Program Files (x86)\Microsoft Visual Studio {VsVersion}.0
  • SQL Server Management Studio (SSMS) and the Dac Framework MSI: C:\Program Files (x86)\Microsoft SQL Server\{SqlVersion}\Dac\bin

SqlVersion is 140 for the SQL Server 2017, 130 for the SQL Server 2016 etc.

VsVersion is 14 for Visual Studio 2017

More details in this question.

查看更多
登录 后发表回答