Thursday, 16 February 2017

Deploying a SQL Server Data Tools Database (DACPAC)

For those of you that take advantage of managing your database as a project within Visual Studio with SQL Server Data Tools, this article will describe how to deploy the resulting file containing your database schema.
Note that SQL Server Data Tools replaces the old Visual Studio 2010 Database Project type. Anyone who wants to migrate their solution to Visual Studio 2012 will have to convert the database project to a SQL Server Data Tools project.
SQL Server Data Tools produces files of type DACPACDACPAC or Data-tier Application Component Packages allows developers to package database into a single file and use it to deploy a database. In these following steps, we will use InRelease to configure a component using DACPAC file to deploy a database.
In this article we assume that:
  • InRelease Server and InRelease Deployer are installed and working.
  • In InRelease, you have a Release Path ready to be used.
  • You have an existing SQL Server Data Tools project in your solution.
  • A build definition has been configured to build your solution in TFS.

Visual Studio Configuration

When a solution containing your SQL Server Data Tools project gets built by team build, it will create a file of type DACPAC which contains the schema definition of your database. It is that file that InRelease will use to deploy your database. This means that there are no modification to make to your solution nor your build definition in order to make this work.

InRelease Configuration

Component Creation and Configuration

Navigate to Configure Apps | Components and create a new component for your DACPAC project. Select the DACPAC Database Deployer as a Tool in the Deployment tab.

Application Version configuration

Navigate to Configure Apps | Release Template and create a new Release Template.
In the toolbox, right click on the Components category and click on Add. You will then be able to link the previously created component. Once the component is in the toolbox, right click on the component and click on Edit.
On the source tab, append a backslash to the Path to package field to indicate the content at the root of the drop location is what is needed.
Drag the component created in the previous step inside a server on the deployment procedure canvas.
Once the component activity is inside the server, you may expand it and fill up the variable values.

No comments:

Post a Comment