Skip to main content
net10.0net8.0

SqlPackage is a command-line utility that automates database development tasks by exposing some of the public Data-Tier Application Framework (DacFx) APIs.

Published
Jun 17, 2026
4mo ago
Total Downloads
6.6M
6,564,056

Install

dotnet add package Microsoft.SqlPackage --version 170.5.29-preview
ProductVersions
.NET
net10.0net8.0

README

Microsoft SQL Server Data-Tier Application Framework (DacFx) SqlPackage CLI

Overview

SqlPackage is a cross-platform command-line utility for creating and deploying .dacpac and .bacpac packages. SqlPackage can be installed as a dotnet tool or downloaded as a standalone executable for Windows, macOS, or Linux. Use this tool to automate database development and deployment tasks for Microsoft SQL Server, Microsoft Azure SQL Database, and SQL in Fabric. SqlPackage is built on top of the Microsoft SQL Server Data-Tier Application Framework (DacFx).

๐Ÿ“— SqlPackage command-line reference documentation

๐Ÿ“— SQL projects database DevOps documentation

The Microsoft SQL Server Data-Tier Application Framework (DacFx) is a .NET library which provides application lifecycle services for database development and management for Microsoft SQL databases. DacFx supports various database deployment and management scenarios, including extracting / exporting a live database to a DAC package, deploying a DAC package to a new or existing database, and migrating from on-premises to Microsoft Azure. DacFx can target all supported versions of SQL Server, as well as Microsoft Azure SQL and SQL in Fabric. DacFx is also available as a NuGet package for use in your own .NET applications.

Installation

To install SqlPackage as a global .NET tool, run the following command:

dotnet tool install -g microsoft.sqlpackage

More information on the options available with the dotnet tool install command can be found in the dotnet tool install documentation.

To update SqlPackage to the latest version, run the following command:

dotnet tool update -g microsoft.sqlpackage

Preview releases of SqlPackage are available with the dotnet tool feed. To access preview releases, use the --prerelease option with the dotnet tool command. For example, to install the latest preview release, run the following command:

dotnet tool install -g --prerelease microsoft.sqlpackage

Usage

The following examples demonstrate some basic functionality of the SqlPackage CLI. For more commands and parameters, refer to the SqlPackage command-line reference documentation.

Example: Deploy a .dacpac to a new or existing database

sqlpackage /Action:Publish /SourceFile:"path\to\your.dacpac" /TargetConnectionString:"your-database-connection-string"

Example: Extract a database to a .dacpac

sqlpackage /Action:Extract /SourceConnectionString:"your-database-connection-string" /TargetFile:"path\to\output.dacpac"

Example: Extract a database to .sql files organized by object type and schema

sqlpackage /Action:Extract /SourceConnectionString:"your-database-connection-string" /TargetFile:"path\to\output\directory" /ExtractTarget:SchemaObjectType

Related components

Component Links Summary
DacFx ๐Ÿ“ฆ NuGet
๐Ÿ“˜ API Docs The Microsoft SQL Server Data-Tier Application Framework (Microsoft.SqlServer.DacFx) is a .NET library which provides application lifecycle services for database development and management for Microsoft SQL Server and Microsoft Azure SQL Databases. Preview versions of DacFx are frequently released to NuGet.
DacpacVerify ๐Ÿ“ฆ Tool Microsoft.DacpacVerify is a cross-platform command-line utility for checking that two .dacpac packages match, including pre/post-deployment scripts and SQLCMD variables.
Dacpacs.(Master,Msdb) ๐Ÿ“ฆ Master
๐Ÿ“ฆ Msdb Microsoft.SqlServer.Dacpacs.Master and Microsoft.SqlServer.Dacpacs.Msdb is a set of NuGet packages containing .dacpac files for Microsoft SQL Server system databases (master, msdb) with versions across SQL Server 2008 (100) through SQL Server 2022 (160).
Dacpacs.Azure.Master ๐Ÿ“ฆ NuGet Microsoft.SqlServer.Dacpacs.Azure.Master is a NuGet package containing a .dacpac file for the Azure SQL Database master database.
Dacpacs.DbFabric ๐Ÿ“ฆ NuGet Microsoft.SqlServer.Dacpacs.DbFabric is a NuGet package containing a .dacpac file for the SQL database in Fabric system objects.
Dacpacs.Synapse.Master ๐Ÿ“ฆ NuGet Microsoft.SqlServer.Dacpacs.Synapse.Master is a NuGet package containing a .dacpac file for the Azure Synapse Analytics master database.
Dacpacs.SynapseServerless.Master ๐Ÿ“ฆ NuGet Microsoft.SqlServer.Dacpacs.SynapseServerless.Master is a NuGet package containing a .dacpac file for the Azure Synapse Analytics serverless SQL pools master database.
ScriptDom ๐Ÿ“ฆ NuGet
๐Ÿ› ๏ธ Code
๐Ÿ“˜ API Docs Microsoft.SqlServer.TransactSql.ScriptDom is a NuGet package containing the Transact-SQL parser ScriptDOM. The source code is licensed MIT.
Microsoft.Build.Sql ๐Ÿ“ฆ NuGet
๐Ÿ“— Docs
๐Ÿ› ๏ธ Code Microsoft.Build.Sql is a .NET project SDK for SQL projects, compiling T-SQL code to a data-tier application package (dacpac).
Project Templates ๐Ÿ“ฆ NuGet
๐Ÿ› ๏ธ Code Microsoft.Build.Sql.Templates is a set of .NET project templates for SQL projects.

Support

Open issues at DacFx GitHub

Changes from Previous Version

No structural changes between v170.4.83 and v170.5.29-preview.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

This version is marked prerelease. Validate its API and upgrade path before production use.No SPDX license expression is published. Review the license text and your organisation's policy before redistribution.Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.