Visual Studio数据库项目提供生成脚本,它还会创建增量数据库更改。
Visual studio database project offers Generate Script and its also creates an incremental DB changes.
我可以使用msbuild或命令行或任何其他第三方组件生成脚本。
Can I generate scripts using msbuild or command line or any other third party component.
推荐答案
您好satyajit015,
Hi satyajit015,
感谢您在这里发帖。
您的意思是根据生成的dacpac文件和实际数据库生成发布脚本吗?如果是,请您可以使用SqlPackage.exe 。在你的机器上查找它与a名称相似的目录:
Do you mean generate the publish script based on the generated dacpac file and the actual database? If yes, 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 ,您可以从这里下载: www.microsoft。 com / zh-CN / download / details.aspx?id = 51941
If you don't have SqlPackage.exe already, you can download it from here: www.microsoft/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:" Data Source = myserver; Initial Catalog = mydb; Integrated Security = 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
有关更详细的信息,请参阅:
For some more detailed info, you can refer to:
stackoverflow/questions/45943575/build-and-generate-script -for-ssdt-project-using-command-line-tools
希望这会有所帮助。
更多推荐
数据库项目
发布评论