Post

Create and publish your custom .NET project templates

In this blog I composed a set of useful tips, samples and materials on how to create, test, use and publish (Nuget.org) your own custom .NET project templates. If you are looking for a recent example, feel free to check out one of my own templates on Github. You can find more details about the template in this dedicated blog entry.

Work with templates

.NET Cli

Visual Studio

Default templates

Custom templates

Articles and documentation

Videos

Code examples

Implementation

  1. Write code, implement template project.
  2. Define template configuration file (template.json). Find documentation here.
  3. Define additional files to override template.json or define additional presentation configurations for .NET CLI (dotnetcli.host.json) and Visual Studio (ide.host.json) hosts.
  4. Use template.json parameters in classes.
  5. Use template.json parameters in .csproj files.

Build package

Find an example here: MightyMentorConsole.Template.csproj.

Install and test locally

Publish

This post is licensed under CC BY 4.0 by the author.