Skip to content

Latest commit

 

History

History
95 lines (65 loc) · 7.13 KB

README.md

File metadata and controls

95 lines (65 loc) · 7.13 KB

DacFx and Related Components

Component Links Summary
SqlPackage 📦 NuGet
📗 Docs
Microsoft.SqlPackage is a cross-platform command-line utility for creating and deploying .dacpac and .bacpac packages. SqlPackage can be installed as a dotnet tool.
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.
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.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
🛠️ Code
Microsoft.Build.Sql (preview) is a .NET project SDK for SQL projects, compiling T-SQL code to a data-tier application package (dacpac). In preview, source code in this repository.
Project Templates 📦 NuGet
🛠️ Code
Microsoft.Build.Sql.Templates (preview) is a set of .NET project templates for SQL projects. In preview, source code in this repository.

Microsoft.Build.Sql SDK-style projects documentation

Related tools and libraries

Quickstart

🛠️ Install SqlPackage

SqlPackage is a command line interface to DacFx and is available for Windows, macOS, and Linux. For more about SqlPackage, check out the reference page on Microsoft Docs.

If you would like to use the command-line utility SqlPackage for creating and deploying .dacpac and .bacpac packages, you can obtain it as a dotnet tool. The tool is available for Windows, macOS, and Linux.

dotnet tool install -g microsoft.sqlpackage

Alternatively, SqlPackage can be downloaded as a zip file from the SqlPackage documentation.

📁 Create a SQL project

Install the Microsoft.Build.Sql.Templates NuGet package to get started with a new SQL project.

dotnet new -i Microsoft.Build.Sql.Templates

Create a new SQL project using the sqlproj template.

dotnet new sqlproj -n ProductsTutorial

Add a new table dbo.Product in a .sql file alongside the project file.

CREATE TABLE [dbo].[Product](
    [ProductID] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY,
    [ProductName] [nvarchar](200) NOT NULL
);

Build the project to create a .dacpac file.

dotnet build

🛳️ Publish a SQL project

Publish a SQL project to a database using the SqlPackage publish command. Learn more about the publish command in the SqlPackage documentation, where additional examples and details on the parameters are available.

# example publish to Azure SQL Database using SQL authentication and a connection string
sqlpackage /Action:Publish /SourceFile:"bin/Debug/ProductsTutorial.dacpac" \
    /TargetConnectionString:"Server=tcp:{yourserver}.database.windows.net,1433;Initial Catalog=ProductsTutorial;User ID=sqladmin;Password={your_password};Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"

Repository Focus

Feedback

This repository is available for transparently triaging and addressing feedback on DacFx, including the NuGet package and the cross-platform CLI SqlPackage. We welcome community interaction and suggestions! For more information on contributing feedback through interacting with issues see Contributing.

Related Open Source Projects

This repository is available to make related open source components accessible even from their early stages. Feedback and contributions are welcome!

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see Code of Conduct.