SQL Server database schema validation, deployment, and upgrade runtime. Enables declarative database development and database portability across SQL Server versions and environments.
Перейти к файлу
Z Chen ac9e6e251b
Add SQL code analysis from PackageReference or ProjectReference (#479)
* Add test for project reference

* Fix test

* Add PackageReference test

* Add missing TestData

* Merge from main

* Update DacFx version

* Remove extra line
2024-09-17 10:07:08 -07:00
.github Remove tests for .NET SDK 3.1 and 5, add tests for .NET 9 (#444) 2024-05-16 12:50:18 -07:00
images Add icon png and fix warnings (#355) 2023-10-20 15:01:17 -07:00
samples/SdkStyleDatabaseProject Update sample.sqlproj (#254) 2023-04-11 11:56:08 -07:00
src Add SQL code analysis from PackageReference or ProjectReference (#479) 2024-09-17 10:07:08 -07:00
test/Microsoft.Build.Sql.Tests Add SQL code analysis from PackageReference or ProjectReference (#479) 2024-09-17 10:07:08 -07:00
.gitignore
CODE_OF_CONDUCT.md
CONTRIBUTING.md
DacFx.sln Fix typo (#241) 2023-03-10 08:43:16 -08:00
Directory.Build.props Add SQL code analysis from PackageReference or ProjectReference (#479) 2024-09-17 10:07:08 -07:00
LICENSE.txt
README.md docs and templates option add for 162.3 (#457) 2024-07-25 15:27:36 -07:00
SECURITY.md

README.md

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

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.

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.