Search code examples
sql-servervisual-studiovisual-studio-2017ssms

How to create a pre-packaged deployment script for a database project?


I have a DB project in Visual Studio and I need to deploy it to a remote system as a pre-packaged script (or similar) as a new database.

The Publish option will generate a .publish SQL script but only if you supply a connection first, and the script includes machine-local information e.g. logging paths.

I want something I can copy onto the DB-server machine running SSMS and it will create the DB. What is the proper way to do this, I see I also have DAC and DLL files emitted during build.


Solution

  • What is the proper way to do this?

    Connect to a server that doesn't have any version of your database, and publish. Publish calculates an incremental deployment, so it needs to see the current state of the target SQL Server.