I'm using SSDT for Visual Studio 2012 here and using its command-line tool SQLPackage.exe
to publish a .dacpac file.
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.
How can I do that?
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.
In Windows Explorer, right-click the DACPAC file you want to use, and click Unpack. The Unpack Microsoft SQL Server DAC Package File dialog opens. Specify the folder you want the files in the DACPAC to be unpacked to, and click Unpack: DACPACs contain a model.
Are you trying to publish to a Database, or create a database project from a dacpac? These are two different things.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With