The templates are available on NuGet. To install the templates, run the following command:
dotnet new install Microsoft.Build.Sql.Templates
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
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
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