Skip to content

dotnet new create project from template

dotnet new creates a new project, configuration file, or solution based on a template.

TemplateCommand
Console appdotnet new console -n MyApp
Web APIdotnet new webapi -n MyApi
Class librarydotnet new classlib -n MyLib
xUnit testdotnet new xunit -n MyTests
Solution filedotnet new sln -n MySolution
Terminal window
# List all templates
dotnet new list
# List console-specific templates
dotnet new list console ```
Terminal window
Create with specific framework
dotnet new console -n MyApp -f net8.0
Create with top-level statements disabled
dotnet new console -n MyApp --use-program-main