问题
What is the difference between using Sqlpackage.exe and Microsoft.SqlServer.Dac.dll to deploy a database? Is there any benefits? We are just trying to deploy a database to localhost. Just curious if Sqlpackage exe has more options/functionalities than Microsoft.SqlServer.Dac.dll, or does it really matter at this point?
SQL Package:
SqlPackage.exe /Action:Publish
/SourceFile:"TestDatabase.dacpac"
/TargetServerName:"localhost"
/TargetDatabaseName:TestDatabase
Microsoft.SqlServer.Dac.dll
add-type -path "C:\Program Files (x86)\Microsoft SQL Server\140\DAC\bin\Microsoft.SqlServer.Dac.dll "
$dacService = new-object Microsoft.SqlServer.Dac.DacServices "Server=localhost;Integrated Security = True;"
$dp = [Microsoft.SqlServer.Dac.DacPackage]::Load("C:\DatabaseTest.dacpac")
$dacService.deploy($dp, "DatabaseTest", "True")
来源:https://stackoverflow.com/questions/57444148/deploy-database-with-sqlpackage-exe-or-microsoft-sqlserver-dac-dll-any-differen