/templating

This repo contains the Template Engine which is used by dotnet new

Primary LanguageC#MIT LicenseMIT

Build Status

Overview

This repository is the home for the .NET Template Engine. It contains the libraries for template instantiation and template package management used in dotnet new and New Project Dialog and New Item Dialog in Visual Studio and Visual Studio for Mac. The libraries are also distributed as the NuGet packages on nuget.org.

The key packages are:

Package name Description
Microsoft.TemplateEngine.Edge The template engine infrastructure: managing template packages, templates, components, executing template. Main API surface for the products aiming to use template engine. See 'Inside Template Engine' article for more information.
Microsoft.TemplateEngine.Abstractions Contains the main contracts between Edge and components
Microsoft.TemplateEngine.Orchestrator.RunnableProjects The template generator based on template.json configuration
Microsoft.TemplateSearch.Common Facilitates template packages search on nuget.org
Microsoft.TemplateEngine.IDE Lightweight API overlay over Microsoft.TemplateEngine.Edge.
Microsoft.TemplateEngine.Authoring.Tasks Authoring tools: MSBuild tasks for template authoring
Microsoft.TemplateEngine.Authoring.CLI Authoring tools: dotnet CLI tool with utilities for template authoring
Microsoft.TemplateEngine.Authoring.TemplateVerifier Authoring tools: snapshot testing framework for the templates

dotnet new

dotnet new CLI is now located in dotnet/sdk repo.

The issues for dotnet new CLI UX should be opened in the that repository.

Template Content Repositories

.NET default templates are not located in this repository. The templates are located in the following repositories:

Templates Repository
Common project and item templates dotnet/sdk
ASP.NET and Blazor templates dotnet/aspnetcore
ASP.NET Single Page Application templates dotnet/spa-templates
WPF templates dotnet/wpf
Windows Forms templates dotnet/winforms
Test templates dotnet/test-templates
MAUI templates dotnet/maui

Issues for the template content should be opened in the corresponding repository. Suggestions for new templates should be opened in closest repository from the list above. For example, if you have a suggestion for new web template, please create an issue in dotnet/aspnetcore repository.

How to author the templates

This repository contains a lot of useful information on how to create the templates supported by dotnet new, Visual Studio and other tools that uses template engine.

The starting point tutorial on how to create new templates is available in Microsoft Learn. More advanced information can be found in the Wiki or docs folder in the repo.

Still have a question about template authoring? Do not hesitate to open new discussion in GitHub Template Authoring.

Authoring Tools

Besides the actual implementation of .NET Template Engine, the repo contains various tools that help to author the templates. They are not shipped together with .NET SDK, but available on NuGet.org. More information can be found here

Template Samples

We have created dotnet template samples, which shows how you can use the template engine to create new templates. The samples are setup to be stand alone for specific examples. More documentation can be found in the Wiki.

Contributing

We welcome contributions! You can contribute by:

See our good first issue candidates for the list of issues we consider as good starting point for first contribution to the repo.

See our help wanted issues for a list of issues we think are great for community contribution.

We have a number of features where we are actively looking for the feedback. They are marked with gathering-feedback label. If you think they are useful for your templates, please let us know in comments or by reacting on those.

Check out our contributing page to learn more details.

How to build, run & debug

Check out our contributing page to learn how you can build, run and debug.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft’s Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party’s policies.