Keep your codebase consistent with custom `dotnet new <TEMPLATES>`
You’ve probably used the dotnet new webapi
command. You might not have given it much thought, but why did you not write the *.csproj file and the program.cs
from scratch? And who do you write other files from scratch?
Building plumbing takes time and it hardly delivers any business value. Scaffolding boilerplate code increases productivity because it allows you to focus on writing code for the things that matter.
If you are a dotnet web developer, big chance you’re working with Angular too. The Angular CLI took generating boilerplate code next level compared to the dotnet CLI. With the Angular CLI you can scaffold much more than just a blank project. ng new component
, for instance, creates a new component (including tests). ng new service
creates a new service. And so forth.
Would it not make much more sense to scaffold typical controllers, aggregates, tests, or deployment pipelines in dotnet too? Imagine being able to just typedotnet new controller
, dotnet new aggregate
, dotnet new repository
, dotnet new integrationtest
, or dotnet new deploymentpipeline
?
Using dotnet templates in your project(s)
In my entire career, I have never come across companies that have similar codebases. Everybody does things differently (which makes sense). That’s why I think it makes sense the dotnet new
CLI is extendible. You can easily create templates that allow you to scaffold things in…