如何通过 SSDT 的 SQLPackage.exe 将 DACPAC 文件发布到 SQL Server 数据库项目? [英] How to publish DACPAC file to a SQL Server database project via SQLPackage.exe of SSDT?

查看:63
本文介绍了如何通过 SSDT 的 SQLPackage.exe 将 DACPAC 文件发布到 SQL Server 数据库项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 SSDT 用于 Visual Studio 2012 此处并使用其命令行工具 SQLPackage.exe 发布 .dacpac 文件.

I'm using SSDT for Visual Studio 2012 here and using its command-line tool SQLPackage.exe to publish a .dacpac file.

我想将其发布到 SQL Server 数据库项目.我试图在这个指南中使用参数,但不能想办法做到这一点.

I want to publish that to an SQL Server database project. I'm trying to use parameter at this guide but cannot find ways how to do it.

我该怎么做?

推荐答案

您是要发布到数据库,还是从 dacpac 创建数据库项目?这是两种不同的东西.

Are you trying to publish to a Database, or create a database project from a dacpac? These are two different things.

  • 要创建基于 dacpac 的数据库项目,请在 Visual Studio 中创建一个新的 SQL Server 数据库项目.然后在解决方案资源管理器中右键单击该项目并选择导入 -> 数据层应用程序 (*.dacpac)"并选择您的 dacpac.这会将 dacpac 的内容转换为项目中的脚本,如果您选择导入数据库设置",数据库选项将根据 dacpac 中的设置进行设置.不幸的是,我所知道的命令行工具无法做到这一点.

  • To create a database project based on a dacpac, create a new SQL Server Database Project in Visual Studio. Then right-click on the project in Solution Explorer and choose "Import -> Data-tier Application (*.dacpac)" and select your dacpac. That will convert the contents of the dacpac into scripts in the project, and if you choose "Import database settings" the database options will be set based on the settings in the dacpac. Unfortunately there's no way to do this via a command line tool that I'm aware of.

要使用 SqlPackage.exe 发布到数据库,您链接到的指南具有所有选项.一个简单的命令是sqlpackage/a:publish/sf:db1.dacpac/tsn:localhost/tdn:db1",用于将 dacpac db1"发布到数据库localhost\db1".对于其他发布选项,请键入sqlpackage/a:publish/?"获取命令行上适用操作的列表.

To use SqlPackage.exe to publish to a database, the guide you linked to has all the options. A simple command would be "sqlpackage /a:publish /sf:db1.dacpac /tsn:localhost /tdn:db1" to publish dacpac "db1" to a database "localhost\db1". For other publish options type "sqlpackage /a:publish /?" to get the list of applicable actions on the command line.

这篇关于如何通过 SSDT 的 SQLPackage.exe 将 DACPAC 文件发布到 SQL Server 数据库项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆