.NET default templates for dotnet new
When you install the .NET SDK, you receive over a dozen built-in templates for creating projects and files, including console apps, class libraries, unit test projects, ASP.NET Core apps (including Angular and React projects), and configuration files. To list the built-in templates, run the dotnet new command with the -l|--list option:
dotnet new --list
The following table shows the templates that come pre-installed with the .NET SDK. The default language for the template is shown inside the brackets. Click on the short name link to see the specific template options.
| Templates | Short name | Language | Tags | Introduced |
|---|---|---|---|---|
| Console Application | console |
[C#], F#, VB | Common/Console | 1.0 |
| Class library | classlib |
[C#], F#, VB | Common/Library | 1.0 |
| WPF Application | wpf |
[C#], VB | Common/WPF | 3.0 (5.0 for VB) |
| WPF Class library | wpflib |
[C#], VB | Common/WPF | 3.0 (5.0 for VB) |
| WPF Custom Control Library | wpfcustomcontrollib |
[C#], VB | Common/WPF | 3.0 (5.0 for VB) |
| WPF User Control Library | wpfusercontrollib |
[C#], VB | Common/WPF | 3.0 (5.0 for VB) |
| Windows Forms (WinForms) Application | winforms |
[C#], VB | Common/WinForms | 3.0 (5.0 for VB) |
| Windows Forms (WinForms) Class library | winformslib |
[C#], VB | Common/WinForms | 3.0 (5.0 for VB) |
| Worker Service | worker |
[C#] | Common/Worker/Web | 3.0 |
| Unit Test Project | mstest |
[C#], F#, VB | Test/MSTest | 1.0 |
| NUnit 3 Test Project | nunit |
[C#], F#, VB | Test/NUnit | 2.1.400 |
| NUnit 3 Test Item | nunit-test |
[C#], F#, VB | Test/NUnit | 2.2 |
| xUnit Test Project | xunit |
[C#], F#, VB | Test/xUnit | 1.0 |
| Razor Component | razorcomponent |
[C#] | Web/ASP.NET | 3.0 |
| Razor Page | page |
[C#] | Web/ASP.NET | 2.0 |
| MVC ViewImports | viewimports |
[C#] | Web/ASP.NET | 2.0 |
| MVC ViewStart | viewstart |
[C#] | Web/ASP.NET | 2.0 |
| Blazor Server App | blazorserver |
[C#] | Web/Blazor | 3.0 |
| Blazor WebAssembly App | blazorwasm |
[C#] | Web/Blazor/WebAssembly | 3.1.300 |
| ASP.NET Core Empty | web |
[C#], F# | Web/Empty | 1.0 |
| ASP.NET Core Web App (Model-View-Controller) | mvc |
[C#], F# | Web/MVC | 1.0 |
| ASP.NET Core Web App | webapp, razor |
[C#] | Web/MVC/Razor Pages | 2.2, 2.0 |
| ASP.NET Core with Angular | angular |
[C#] | Web/MVC/SPA | 2.0 |
| ASP.NET Core with React.js | react |
[C#] | Web/MVC/SPA | 2.0 |
| ASP.NET Core with React.js and Redux | reactredux |
[C#] | Web/MVC/SPA | 2.0 |
| Razor Class Library | razorclasslib |
[C#] | Web/Razor/Library/Razor Class Library | 2.1 |
| ASP.NET Core Web API | webapi |
[C#], F# | Web/WebAPI | 1.0 |
| ASP.NET Core gRPC Service | grpc |
[C#] | Web/gRPC | 3.0 |
| dotnet gitignore file | gitignore |
Config | 3.0 | |
| global.json file | globaljson |
Config | 2.0 | |
| NuGet Config | nugetconfig |
Config | 1.0 | |
| Dotnet local tool manifest file | tool-manifest |
Config | 3.0 | |
| Web Config | webconfig |
Config | 1.0 | |
| Solution File | sln |
Solution | 1.0 | |
| Protocol Buffer File | proto |
Web/gRPC | 3.0 | |
| EditorConfig file | editorconfig(#editorconfig) |
Config | 6.0 |
Template options
Each template may have additional options available. The core templates have the following additional options:
console
-f|--framework <FRAMEWORK>Specifies the framework to target. Available since .NET Core 3.0 SDK.
The following table lists the default values according to the SDK version number you're using:
SDK version Default value 6.0 net6.05.0 net5.03.1 netcoreapp3.1The ability to create a project for an earlier TFM depends on having that version of the SDK installed. For example, if you have only SDK 5.0 installed, then the only value available for
--frameworkisnet5.0. If you install SDK 3.1, the valuenetcoreapp3.1becomes available for--framework. If you install SDK 2.1,netcoreapp2.1becomes available, and so on. So by specifying--framework netcoreapp2.1you can use SDK 2.1 even while runningdotnet newin SDK 5.0.Alternatively, to create a project that targets a framework earlier than the SDK that you're using, you might be able to do it by installing the NuGet package for the template. Common, web, and SPA project types use different packages per target framework moniker (TFM). For example, to create a
consoleproject that targetsnetcoreapp1.0, rundotnet new --installonMicrosoft.DotNet.Common.ProjectTemplates.1.x.--langVersion <VERSION_NUMBER>Sets the
LangVersionproperty in the created project file. For example, use--langVersion 7.3to use C# 7.3. Not supported for F#. Available since .NET Core 2.2 SDK.For a list of default C# versions, see Defaults.
--no-restoreIf specified, doesn't execute an implicit restore during project creation. Available since .NET Core 2.2 SDK.
classlib
-f|--framework <FRAMEWORK>Specifies the framework to target. Values:
net6.0,net5.0, ornetcoreapp3.1to create a .NET Class Library ornetstandard<version>to create a .NET Standard Class Library. The default value for .NET 6 SDK isnet6.0.To create a project that targets a framework earlier than the SDK that you're using, see
--frameworkforconsoleprojects earlier in this article.--langVersion <VERSION_NUMBER>Sets the
LangVersionproperty in the created project file. For example, use--langVersion 7.3to use C# 7.3. Not supported for F#. Available since .NET Core 2.2 SDK.For a list of default C# versions, see Defaults.
--no-restoreDoesn't execute an implicit restore during project creation.
wpf, wpflib, wpfcustomcontrollib, wpfusercontrollib
-f|--framework <FRAMEWORK>Specifies the framework to target. For the .NET 6 SDK, the default value is
net6.0. Available since .NET Core 3.1 SDK.To create a project that targets a framework earlier than the SDK that you're using, see
--frameworkforconsoleprojects earlier in this article.--langVersion <VERSION_NUMBER>Sets the
LangVersionproperty in the created project file. For example, use--langVersion 7.3to use C# 7.3.For a list of default C# versions, see Defaults.
--no-restoreDoesn't execute an implicit restore during project creation.
winforms, winformslib
--langVersion <VERSION_NUMBER>Sets the
LangVersionproperty in the created project file. For example, use--langVersion 7.3to use C# 7.3.For a list of default C# versions, see Defaults.
--no-restoreDoesn't execute an implicit restore during project creation.
worker, grpc
-f|--framework <FRAMEWORK>Specifies the framework to target. The default value is
netcoreapp3.1. Available since .NET Core 3.1 SDK.To create a project that targets a framework earlier than the SDK that you're using, see
--frameworkforconsoleprojects earlier in this article.--exclude-launch-settingsExcludes launchSettings.json from the generated template.
--no-restoreDoesn't execute an implicit restore during project creation.
mstest, xunit
-f|--framework <FRAMEWORK>Specifies the framework to target. Option available since .NET Core 3.0 SDK.
The following table lists the default values according to the SDK version number you're using:
SDK version Default value 6.0 net6.05.0 net5.03.1 netcoreapp3.13.0 netcoreapp3.0To create a project that targets a framework earlier than the SDK that you're using, see
--frameworkforconsoleprojects earlier in this article.-p|--enable-packEnables packaging for the project using dotnet pack.
--no-restoreDoesn't execute an implicit restore during project creation.
nunit
-f|--framework <FRAMEWORK>Specifies the framework to target.
The following table lists the default values according to the SDK version number you're using:
SDK version Default value 6.0 net6.05.0 net5.03.1 netcoreapp3.13.0 netcoreapp3.02.2 netcoreapp2.22.1 netcoreapp2.1To create a project that targets a framework earlier than the SDK that you're using, see
--frameworkforconsoleprojects earlier in this article.-p|--enable-packEnables packaging for the project using dotnet pack.
--no-restoreDoesn't execute an implicit restore during project creation.
page
-na|--namespace <NAMESPACE_NAME>Namespace for the generated code. The default value is
MyApp.Namespace.-np|--no-pagemodelCreates the page without a PageModel.
viewimports, proto
-na|--namespace <NAMESPACE_NAME>Namespace for the generated code. The default value is
MyApp.Namespace.
blazorserver
-au|--auth <AUTHENTICATION_TYPE>The type of authentication to use. The possible values are:
None- No authentication (Default).Individual- Individual authentication.IndividualB2C- Individual authentication with Azure AD B2C.SingleOrg- Organizational authentication for a single tenant.MultiOrg- Organizational authentication for multiple tenants.Windows- Windows authentication.
--aad-b2c-instance <INSTANCE>The Azure Active Directory B2C instance to connect to. Use with
IndividualB2Cauthentication. The default value ishttps://login.microsoftonline.com/tfp/.-ssp|--susi-policy-id <ID>The sign-in and sign-up policy ID for this project. Use with
IndividualB2Cauthentication.-rp|--reset-password-policy-id <ID>The reset password policy ID for this project. Use with
IndividualB2Cauthentication.-ep|--edit-profile-policy-id <ID>The edit profile policy ID for this project. Use with
IndividualB2Cauthentication.--aad-instance <INSTANCE>The Azure Active Directory instance to connect to. Use with
SingleOrgorMultiOrgauthentication. The default value ishttps://login.microsoftonline.com/.--client-id <ID>The Client ID for this project. Use with
IndividualB2C,SingleOrg, orMultiOrgauthentication. The default value is11111111-1111-1111-11111111111111111.--domain <DOMAIN>The domain for the directory tenant. Use with
SingleOrgorIndividualB2Cauthentication. The default value isqualified.domain.name.--tenant-id <ID>The TenantId ID of the directory to connect to. Use with
SingleOrgauthentication. The default value is22222222-2222-2222-2222-222222222222.--callback-path <PATH>The request path within the application's base path of the redirect URI. Use with
SingleOrgorIndividualB2Cauthentication. The default value is/signin-oidc.-r|--org-read-accessAllows this application read-access to the directory. Only applies to
SingleOrgorMultiOrgauthentication.--exclude-launch-settingsExcludes launchSettings.json from the generated template.
--no-httpsTurns off HTTPS. This option only applies if
Individual,IndividualB2C,SingleOrg, orMultiOrgaren't being used for--auth.-uld|--use-local-dbSpecifies LocalDB should be used instead of SQLite. Only applies to
IndividualorIndividualB2Cauthentication.--no-restoreDoesn't execute an implicit restore during project creation.
blazorwasm
-f|--framework <FRAMEWORK>Specifies the framework to target.
The following table lists the default values according to the SDK version number you're using:
SDK version Default value 6.0 net6.05.0 net5.03.1 netcoreapp3.1To create a project that targets a framework earlier than the SDK that you're using, see
--frameworkforconsoleprojects earlier in this article.--no-restoreDoesn't execute an implicit restore during project creation.
-ho|--hostedIncludes an ASP.NET Core host for the Blazor WebAssembly app.
-au|--auth <AUTHENTICATION_TYPE>The type of authentication to use. The possible values are:
None- No authentication (Default).Individual- Individual authentication.IndividualB2C- Individual authentication with Azure AD B2C.SingleOrg- Organizational authentication for a single tenant.
--authority <AUTHORITY>The authority of the OIDC provider. Use with
Individualauthentication. The default value ishttps://login.microsoftonline.com/.--aad-b2c-instance <INSTANCE>The Azure Active Directory B2C instance to connect to. Use with
IndividualB2Cauthentication. The default value ishttps://aadB2CInstance.b2clogin.com/.-ssp|--susi-policy-id <ID>The sign-in and sign-up policy ID for this project. Use with
IndividualB2Cauthentication.--aad-instance <INSTANCE>The Azure Active Directory instance to connect to. Use with
SingleOrgauthentication. The default value ishttps://login.microsoftonline.com/.--client-id <ID>The Client ID for this project. Use with
IndividualB2C,SingleOrg, orIndividualauthentication in standalone scenarios. The default value is33333333-3333-3333-33333333333333333.--domain <DOMAIN>The domain for the directory tenant. Use with
SingleOrgorIndividualB2Cauthentication. The default value isqualified.domain.name.--app-id-uri <URI>The App ID Uri for the server API you want to call. Use with
SingleOrgorIndividualB2Cauthentication. The default value isapi.id.uri.--api-client-id <ID>The Client ID for the API that the server hosts. Use with
SingleOrgorIndividualB2Cauthentication. The default value is11111111-1111-1111-11111111111111111.-s|--default-scope <SCOPE>The API scope the client needs to request to provision an access token. Use with
SingleOrgorIndividualB2Cauthentication. The default value isuser_impersonation.--tenant-id <ID>The TenantId ID of the directory to connect to. Use with
SingleOrgauthentication. The default value is22222222-2222-2222-2222-222222222222.-r|--org-read-accessAllows this application read-access to the directory. Only applies to
SingleOrgauthentication.--exclude-launch-settingsExcludes launchSettings.json from the generated template.
-p|--pwaproduces a Progressive Web Application (PWA) supporting installation and offline use.
--no-httpsTurns off HTTPS. This option only applies if
Individual,IndividualB2C, orSingleOrgaren't being used for--auth.-uld|--use-local-dbSpecifies LocalDB should be used instead of SQLite. Only applies to
IndividualorIndividualB2Cauthentication.--called-api-url <URL>URL of the API to call from the web app. Only applies to
SingleOrgorIndividualB2Cauthentication without an ASP.NET Core host specified. The default value ishttps://graph.microsoft.com/v1.0/me.--calls-graphSpecifies if the web app calls Microsoft Graph. Only applies to
SingleOrgauthentication.--called-api-scopes <SCOPES>Scopes to request to call the API from the web app. Only applies to
SingleOrgorIndividualB2Cauthentication without an ASP.NET Core host specified. The default isuser.read.
web
--exclude-launch-settingsExcludes launchSettings.json from the generated template.
-f|--framework <FRAMEWORK>Specifies the framework to target. Option not available in .NET Core 2.2 SDK.
The following table lists the default values according to the SDK version number you're using:
SDK version Default value 6.0 net6.05.0 net5.03.1 netcoreapp3.13.0 netcoreapp3.02.1 netcoreapp2.1To create a project that targets a framework earlier than the SDK that you're using, see
--frameworkforconsoleprojects earlier in this article.--no-restoreDoesn't execute an implicit restore during project creation.
--no-httpsTurns off HTTPS.
mvc, webapp
-au|--auth <AUTHENTICATION_TYPE>The type of authentication to use. The possible values are:
None- No authentication (Default).Individual- Individual authentication.IndividualB2C- Individual authentication with Azure AD B2C.SingleOrg- Organizational authentication for a single tenant.MultiOrg- Organizational authentication for multiple tenants.Windows- Windows authentication.
--aad-b2c-instance <INSTANCE>The Azure Active Directory B2C instance to connect to. Use with
IndividualB2Cauthentication. The default value ishttps://login.microsoftonline.com/tfp/.-ssp|--susi-policy-id <ID>The sign-in and sign-up policy ID for this project. Use with
IndividualB2Cauthentication.-rp|--reset-password-policy-id <ID>The reset password policy ID for this project. Use with
IndividualB2Cauthentication.-ep|--edit-profile-policy-id <ID>The edit profile policy ID for this project. Use with
IndividualB2Cauthentication.--aad-instance <INSTANCE>The Azure Active Directory instance to connect to. Use with
SingleOrgorMultiOrgauthentication. The default value ishttps://login.microsoftonline.com/.--client-id <ID>The Client ID for this project. Use with
IndividualB2C,SingleOrg, orMultiOrgauthentication. The default value is11111111-1111-1111-11111111111111111.--domain <DOMAIN>The domain for the directory tenant. Use with
SingleOrgorIndividualB2Cauthentication. The default value isqualified.domain.name.--tenant-id <ID>The TenantId ID of the directory to connect to. Use with
SingleOrgauthentication. The default value is22222222-2222-2222-2222-222222222222.--callback-path <PATH>The request path within the application's base path of the redirect URI. Use with
SingleOrgorIndividualB2Cauthentication. The default value is/signin-oidc.-r|--org-read-accessAllows this application read-access to the directory. Only applies to
SingleOrgorMultiOrgauthentication.--exclude-launch-settingsExcludes launchSettings.json from the generated template.
--no-httpsTurns off HTTPS. This option only applies if
Individual,IndividualB2C,SingleOrg, orMultiOrgaren't being used.-uld|--use-local-dbSpecifies LocalDB should be used instead of SQLite. Only applies to
IndividualorIndividualB2Cauthentication.-f|--framework <FRAMEWORK>Specifies the framework to target. Option available since .NET Core 3.0 SDK.
The following table lists the default values according to the SDK version number you're using:
SDK version Default value 6.0 net6.05.0 net5.03.1 netcoreapp3.13.0 netcoreapp3.0To create a project that targets a framework earlier than the SDK that you're using, see
--frameworkforconsoleprojects earlier in this article.--no-restoreDoesn't execute an implicit restore during project creation.
--use-browserlinkIncludes BrowserLink in the project. Option not available in .NET Core 2.2 and 3.1 SDK.
-rrc|--razor-runtime-compilationDetermines if the project is configured to use Razor runtime compilation in Debug builds. Option available since .NET Core 3.1.201 SDK.
angular, react
-au|--auth <AUTHENTICATION_TYPE>The type of authentication to use. Available since .NET Core 3.0 SDK.
The possible values are:
None- No authentication (Default).Individual- Individual authentication.
--exclude-launch-settingsExcludes launchSettings.json from the generated template.
--no-restoreDoesn't execute an implicit restore during project creation.
--no-httpsTurns off HTTPS. This option only applies if authentication is
None.-uld|--use-local-dbSpecifies LocalDB should be used instead of SQLite. Only applies to
IndividualorIndividualB2Cauthentication. Available since .NET Core 3.0 SDK.-f|--framework <FRAMEWORK>Specifies the framework to target. Option not available in .NET Core 2.2 SDK.
The following table lists the default values according to the SDK version number you're using:
SDK version Default value 6.0 net6.05.0 net5.03.1 netcoreapp3.13.0 netcoreapp3.02.1 netcoreapp2.0To create a project that targets a framework earlier than the SDK that you're using, see
--frameworkforconsoleprojects earlier in this article.
reactredux
--exclude-launch-settingsExcludes launchSettings.json from the generated template.
-f|--framework <FRAMEWORK>Specifies the framework to target. Option not available in .NET Core 2.2 SDK.
The following table lists the default values according to the SDK version number you're using:
SDK version Default value 6.0 net6.05.0 net5.03.1 netcoreapp3.13.0 netcoreapp3.02.1 netcoreapp2.0To create a project that targets a framework earlier than the SDK that you're using, see
--frameworkforconsoleprojects earlier in this article.--no-restoreDoesn't execute an implicit restore during project creation.
--no-httpsTurns off HTTPS.
razorclasslib
--no-restoreDoesn't execute an implicit restore during project creation.
-s|--support-pages-and-viewsSupports adding traditional Razor pages and Views in addition to components to this library. Available since .NET Core 3.0 SDK.
webapi
-au|--auth <AUTHENTICATION_TYPE>The type of authentication to use. The possible values are:
None- No authentication (Default).IndividualB2C- Individual authentication with Azure AD B2C.SingleOrg- Organizational authentication for a single tenant.Windows- Windows authentication.
--aad-b2c-instance <INSTANCE>The Azure Active Directory B2C instance to connect to. Use with
IndividualB2Cauthentication. The default value ishttps://login.microsoftonline.com/tfp/.-ssp|--susi-policy-id <ID>The sign-in and sign-up policy ID for this project. Use with
IndividualB2Cauthentication.--aad-instance <INSTANCE>The Azure Active Directory instance to connect to. Use with
SingleOrgauthentication. The default value ishttps://login.microsoftonline.com/.--client-id <ID>The Client ID for this project. Use with
IndividualB2CorSingleOrgauthentication. The default value is11111111-1111-1111-11111111111111111.--domain <DOMAIN>The domain for the directory tenant. Use with
IndividualB2CorSingleOrgauthentication. The default value isqualified.domain.name.--tenant-id <ID>The TenantId ID of the directory to connect to. Use with
SingleOrgauthentication. The default value is22222222-2222-2222-2222-222222222222.-r|--org-read-accessAllows this application read-access to the directory. Only applies to
SingleOrgauthentication.--exclude-launch-settingsExcludes launchSettings.json from the generated template.
--no-httpsTurns off HTTPS.
app.UseHstsandapp.UseHttpsRedirectionaren't added toStartup.Configure. This option only applies ifIndividualB2CorSingleOrgaren't being used for authentication.-uld|--use-local-dbSpecifies LocalDB should be used instead of SQLite. Only applies to
IndividualB2Cauthentication.-f|--framework <FRAMEWORK>Specifies the framework to target. Option not available in .NET Core 2.2 SDK.
The following table lists the default values according to the SDK version number you're using:
SDK version Default value 6.0 net6.05.0 net5.03.1 netcoreapp3.13.0 netcoreapp3.02.1 netcoreapp2.1To create a project that targets a framework earlier than the SDK that you're using, see
--frameworkforconsoleprojects earlier in this article.--no-restoreDoesn't execute an implicit restore during project creation.
globaljson
--sdk-version <VERSION_NUMBER>Specifies the version of the .NET SDK to use in the global.json file.
editorconfig
Creates an .editorconfig file for configuring code style preferences.
--emptyCreates an empty .editorconfig instead of the defaults for .NET.