Edit

Share via


Build a database project from command line

Important

Azure Data Studio is retiring on February 28, 2026. We recommend that you use Visual Studio Code. For more information about migrating to Visual Studio Code, visit What's happening to Azure Data Studio?

While the SQL Database Project extension provides a graphical user interface to build SQL database projects, a command line build experience is also available for Windows, macOS, and Linux environments. This article outlines the prerequisites and syntax needed to build a .dacpac from a Microsoft.Build.Sql SDK-style SQL project at the command line.

Microsoft.Build.Sql with .NET

Using Microsoft.Build.Sql with SDK-style SQL projects is the preferred method for working with SQL projects from the command line.

To build an SDK-style SQL project from the command line on Windows, macOS, or Linux, use the following command:

dotnet build

Optionally, you can specify the project name. Specifying the project name enables building a specific project within a more complex folder structure.

dotnet build AdventureWorks/AdventureWorks.sqlproj

Microsoft.Build.Sql with .NET Framework

Starting with Microsoft.Build.Sql 2.0.0-preview.3, SDK-style SQL projects can be built from the command line with .NET Framework and msbuild. For SQLCLR objects, .NET Framework is required to build the SQL project.

msbuild AdventureWorks/AdventureWorks.sqlproj