Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.
In my last post, I talked about what a DACPAC was. Now let’s create one. This turns out to be about as simple as it could be. First, let’s choose a database. In my case, I’ll use the PartsUnlimited database on my SQL Server 2016 instance. I’ll start by right clicking the database and selecting “Tasks”.
Down near the bottom there is an “Extract Data-tier Application” entry. Choose that. Once you do, you should get a wizard screen. We’ll click past the first screen.
Next we need to set the properties of the DACPAC we are building. The application name is usually the database. The version can be anything, but ideally you are versioning your database in some way. Most people don’t, so they can leave this as 126.96.36.199. If you are actually building your database somehow, you ought to be using a CI process and have some version number. Ideally you’d keep this somewhere in the db and rev it.
We also need to include an optional description and a path to the file. I’ll leave the defaults, but feel free to change these as needed.
The next screen is a summary. If everything looks OK, click Next. This will start the creation of the .DACPAC.
The final screen will show progress, which is fairly short and simple. I think this has always worked for me. If I click the “Finish” button at the bottom (not shown), the dialog disappears.
If I go to the file location, I’ll see my DACPAC in the filesystem. The file is recognized as an SSMS file, and in another post we’ll look at how we unpack this.
I can check this file, however, to be sure there is something inside it. This is a zip file, and if I open it in 7-Zip, I see this:
Opening the model.xml file, I see data that seems like it describes my database. I talked about this in my previous post.
There, a simple DACPAC. This is a format Microsoft uses, and while it’s not perfect, at least I now know how to build one.
This post really took me about 10 minutes, across a few days. I started it after building a DACPAC, and taking the screenshots, but I didn’t have time to write it. I finally spent the other 6 or so minutes putting these words down the next week.
A quick showcase of something I learned.