Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
While the SQL Database Project extension in Visual Studio Code 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, specify the project name. If you specify the project name, you can build 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, you can build SDK-style SQL projects from the command line using .NET Framework and msbuild. For SQLCLR objects, .NET Framework is required to build the SQL project.
msbuild AdventureWorks/AdventureWorks.sqlproj