.NET › .NET CLI, SDK & Project Structure (csproj)

What does `dotnet new` do, and how do you list available project templates?

Beginner

Answer

`dotnet new <template>` scaffolds a new project or file from a built-in or installed template (like webapi, console, classlib, mvc, blazorwasm). `dotnet new list` shows all available templates, including ones installed from third-party template packages via `dotnet new install`.
dotnet new list
dotnet new webapi -n MyApi --use-controllers
dotnet new gitignore
Real-world example A team creates a custom internal template package with `dotnet new install` so every new microservice starts from a pre-configured template with logging, health checks, and standard middleware already wired up.

Common follow-ups: How do you create a custom dotnet new template?;What's the difference between --output and --name options?