问题
I've got a .dacpac file that's being called by MSBuild and published to a QA database for testing. This publish is failing and the error I'm getting back from them is a generic "an error has occurred" message. I was hoping I could generate the deployment script from the dacpac and walk through it to see where the problem is occurring and hopefully teach them how to do this as well.
Is there any way to point a dacpac at a specific database and have it generate the sql for updating the database without actually publishing to the database?
回答1:
You can use SqlPackage.exe. Look for it on your machine in a directory with a name similar to this:
C:\Program Files (x86)\Microsoft SQL Server\130\DAC\bin
Note that it may be found in the 110, 120 or 130 folder.
If you don't have SqlPackage.exe already, you can download it from here: https://www.microsoft.com/en-us/download/details.aspx?id=51941
If you download it, be sure to look in the System Requirements section of the download page to find the dependencies SqlSysClrTypes.msi and SqlDom.msi, which must be installed as well.
Example usage:
SqlPackage.exe /a:script /SourceFile:C:\temp\mydb.dacpac /TargetConnectionString:"Data Source=myserver;Initial Catalog=mydb;Integrated Security=true" /OutputPath:C:\temp
来源:https://stackoverflow.com/questions/37552043/can-i-generate-a-deployment-script-from-a-dacpac