Archives - Tag: Template
Making a custom `dotnet new` template
Why make a template
I am a bit biased these days, but once I spin up a folder structure and/or text document manually more than twice, I give some thought to templating it. If I need to keep making more of something, the time to get all the boilerplate content in place is time taken away from the good stuff I want to write.
This is the first in a series of posts about creating custom templates for the
dotnet new
system.Add variables to your custom `dotnet new` template
Previously, I covered creating your first custom
dotnet new
template. Now, let’s work on customizing the content our template generates based on inputs provided via the command line. I’ll be working from the same custom template from that post, which is just adotnet new console
output with its own .template.config setup. If you want a starter template project to get you going, use the template from the 1-custom-template folder from the Git repo from that blog post.This is the second in a collection of posts about creating custom templates for the
dotnet new
system.Fallback variables in `dotnet new` templates
Previously, we created our first custom
dotnet new
template and added our first input parameter for it. Next, let’s get a little more advanced with our parameters to make our life easier. In this post, we’ll create a template symbol that will function like a coalesce operator, taking a preferred input but falling back to a different input if the preferred value is not found.This is the third in a collection of posts about creating custom templates for the
dotnet new
system.