Skip to main content
net8.0

Templates for creating new Microsoft.Build.Sql projects.

Published
Feb 28, 2025
1y ago
Total Downloads
78.8K
78,774

Install

dotnet add package Microsoft.Build.Sql.Templates --version 1.0.0-rc2
ProductVersions
.NET
net8.0

README

Microsoft.Build.Sql.Templates

SQL projects templates for a new project and a sample code analysis rule.

📗 Learn more about SQL projects at https://learn.microsoft.com/sql/tools/sql-database-projects/sql-database-projects

Installing the templates

The templates are available on NuGet. To install the templates, run the following command:

dotnet new install Microsoft.Build.Sql.Templates

Microsoft.Build.Sql projects and code analysis rules can be created using the sqlproj and sqlcodeanalysis templates, respectively. Both projects require .NET SDK 8 or higher.

Using the templates

SQL project

Creating a new project "AdventureWorks" (-n or --name):

dotnet new sqlproj -n "AdventureWorks"

Displaying help information for the SQL project template (-h):

dotnet new sqlproj -h

Creating a new project "AdventureWorksLT" for Azure SQL Database (-tp or --target-platform):

dotnet new sqlproj -n "AdventureWorksLT" -tp "SqlAzureV12"

Creating a new project "AdventureWorks" with a .gitignore file (-g):

dotnet new sqlproj -n "AdventureWorks" -g

New sample code analysis rule

Creating a new sample code analysis rule "WaitForDelay" (-n or --name):

dotnet new sqlcodeanalysis -n "WaitForDelay"

Displaying help information for the SQL code analysis template (-h):

dotnet new sqlcodeanalysis -h

Building the templates

If you want to customize or contribute to the templates, you will need to build and install the templates locally. The following instructions will help you get started.

The templates automatically generate a nupkg on build. To build and install the nupkg locally, run the following command:

dotnet build
dotnet new install bin/Debug/Microsoft.Build.Sql.Templates.1.0.0.nupkg

To uninstall the templates

dotnet new uninstall Microsoft.Build.Sql.Templates

Resources

Changes from Previous Version

No structural changes between v1.0.0-rc1 and v1.0.0-rc2.

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 1 target framework; confirm the exact target used by your application.

Related Guides & Workflows

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