Where is SQLPackage?

What is SqlPackage?

From: SqlPackage.exe - SQL Server | Microsoft Docs

SqlPackage.exe is a command-line utility that automates the following database development tasks:
  • Version: Returns the build number of the SqlPackage application. Added in version 18.6.
  • Extract: Creates a data-tier application (.dacpac) file containing the schema or schema and user data from a connected SQL database.
  • Publish: Incrementally updates a database schema to match the schema of a source .dacpac file. If the database does not exist on the server, the publish operation creates it. Otherwise, an existing database is updated.
  • Export: Exports a connected SQL database - including database schema and user data - to a BACPAC file (.bacpac).
  • Import: Imports the schema and table data from a BACPAC file into a new user database.
  • DeployReport: Creates an XML report of the changes that would be made by a publish action.
  • DriftReport: Creates an XML report of the changes that have been made to a registered database since it was last registered.
  • Script: Creates a Transact-SQL incremental update script that updates the schema of a target to match the schema of a source.
The SqlPackage.exe command line tool allows you to specify these actions along with action-specific parameters and properties.
Download the latest version. For details about the latest release, see the release notes.

If you have Visual Studio, SQL Server of SQL Server Management Studio installed - you may already have SqlPackage installed on your machine.

Common locations to find SqlPackage.exe:

  • Visual Studio
    • C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC
    • C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\150
    • C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\150
  • SQL Server:
    • C:\Program Files\Microsoft SQL Server\150\DAC\bin\
Note that drive letters will depend on where you installed a product and also which version of product you have installed. I've also only listed the locations I know about for DAC version 150. You will notice that you will most likely have older version of SqlPackage in the DAC folder, such as 140 and 130 etc... We use version 150 to deploy to SQL Server versions as low as 2012 (DAC 110).

At work we use SqlPackage extensively to deploy all our databases. We have recently added a DeploymentPlanModifier extension to document what is being changed for each release in a more human friendly manner (we chose markdown which is then also rendered as html) for consumption by other teams that need to know what changes are being made. I will post about that in a future post.