我可以从dacpac生成部署脚本吗 [英] Can I generate a deployment script from a dacpac
问题描述
我有一个.dacpac文件,MSBuild正在调用该文件,并将其发布到QA数据库进行测试.此发布失败,我从他们那里找回来的错误是一条通用的发生错误"消息.我希望我可以从dacpac中生成部署脚本,并逐步浏览该脚本,以查看问题发生的位置,并希望教他们如何做.
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.
是否可以将dacpac指向特定的数据库,并使其生成用于更新数据库的sql,而无需实际发布到数据库?
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?
推荐答案
您可以使用 SqlPackage.exe .在您的计算机上的名称类似于以下名称的目录中查找它:
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
C:\Program Files (x86)\Microsoft SQL Server\130\DAC\bin
请注意,它可以在110
,120
或130
文件夹中找到.
Note that it may be found in the 110
, 120
or 130
folder.
如果您还没有SqlPackage.exe
,则可以从此处下载: https://www.microsoft.com/zh-cn/download/details.aspx?id=51941
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
如果下载了它,请一定要查看下载页面的系统要求"部分,以找到必须同时安装的依赖项SqlSysClrTypes.msi
和SqlDom.msi
.
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.
示例用法:
SqlPackage.exe/a:script/SourceFile:C:\temp\mydb.dacpac/TargetConnectionString:数据源= myserver;初始目录= mydb;集成安全性= true"/OutputPath:C:\ temp
SqlPackage.exe /a:script /SourceFile:C:\temp\mydb.dacpac /TargetConnectionString:"Data Source=myserver;Initial Catalog=mydb;Integrated Security=true" /OutputPath:C:\temp
这篇关于我可以从dacpac生成部署脚本吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!