dotnet new create project from template
dotnet new creates a new project, configuration file, or solution based on a template.
Common Templates
Section titled “Common Templates”| Template | Command |
|---|---|
| Console app | dotnet new console -n MyApp |
| Web API | dotnet new webapi -n MyApi |
| Class library | dotnet new classlib -n MyLib |
| xUnit test | dotnet new xunit -n MyTests |
| Solution file | dotnet new sln -n MySolution |
List Available Templates
Section titled “List Available Templates”# List all templatesdotnet new list
# List console-specific templatesdotnet new list console ```Template Options
Section titled “Template Options”Create with specific frameworkdotnet new console -n MyApp -f net8.0
Create with top-level statements disableddotnet new console -n MyApp --use-program-main