How to Publish Visual Studio Database Project in VS 2015

toddmo picture toddmo · Feb 3, 2016 · Viewed 12.5k times · Source

I was unable to google this.

We have an existing database project (sql server).

Some new files (scripts) were added.

We have an existing server / database where some new scripts need to be run into that context.

In Visual Studio 2015, how can I accomplish this?

I was told to stay inside Visual Studio 2015. Ideally, I'd like to issue one command vs one for each individual script.

Answer

Keith picture Keith · Feb 3, 2016

You have a couple of choices.

  1. The Publish option. This is a totally automated deployment of what's in the db project to the target server. Do this by right-clicking your project and selecting Publish. This option can be used to perform an incremental deployment (only the changes are deployed) or can be used to wipe a database clean followed by a full deployment of the db project, so check all options before performing publishing.
  2. Schema Comparisons. Schema comparisons perform a comparison of the db project to the target database, shows you the differences, and lets you select which differences to deploy. You can perform a schema comparison by adding a new Schema Compare file to your database project.

In short, the publish option allows automated brute force deployments whereas schema comparisons provide more flexibility by letting you choose which changes to deploy but cannot be automated.