DOTNET-NEW-SDK-TEMPLATES(1)
β¨ .NET default templates for dotnet new β¨
okay bestie, gather round, because this is DOTNET-NEW-SDK-TEMPLATES(1) and it is lowkey one of the most useful pages in the whole .NET universe π
The way that when you install the .NET SDK (https://dotnet.microsoft.com/download) you justβ¦ get over a dozen built-in templates for creating projects and files? Not me being dramatic, it's literally true. You get templates for console apps, class libraries, unit test projects, ASP.NET Core apps (including Angular (https://angular.io/) and React (https://reactjs.org/) projects), and configuration files. All of them. Pre-installed. No cap. π
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.
β¨ THE ICONIC TEMPLATE LINEUP β¨
- Console Application β short name
consoleβ languages[C#],F#,VBβ tagsCommon/Consoleβ introduced in1.0 - Class library β short name
classlibβ languages[C#],F#,VBβ tagsCommon/Libraryβ introduced in1.0 - WPF Application β short name
wpfβ languages[C#],VBβ tagsCommon/WPFβ introduced in3.0(5.0for VB) - WPF Class library β short name
wpflibβ languages[C#],VBβ tagsCommon/WPFβ introduced in3.0(5.0for VB) - WPF Custom Control Library β short name
wpfcustomcontrollibβ languages[C#],VBβ tagsCommon/WPFβ introduced in3.0(5.0for VB) - WPF User Control Library β short name
wpfusercontrollibβ languages[C#],VBβ tagsCommon/WPFβ introduced in3.0(5.0for VB) - Windows Forms (WinForms) Application β short name
winformsβ languages[C#],VBβ tagsCommon/WinFormsβ introduced in3.0(5.0for VB) - Windows Forms (WinForms) Class library β short name
winformslibβ languages[C#],VBβ tagsCommon/WinFormsβ introduced in3.0(5.0for VB) - Worker Service β short name
workerβ languages[C#]β tagsCommon/Worker/Webβ introduced in3.0 - Unit Test Project β short name
mstestβ languages[C#],F#,VBβ tagsTest/MSTestβ introduced in1.0 - NUnit 3 Test Project β short name
nunitβ languages[C#],F#,VBβ tagsTest/NUnitβ introduced in2.1.400 - NUnit 3 Test Item β short name
nunit-testβ languages[C#],F#,VBβ tagsTest/NUnitβ introduced in2.2 - xUnit Test Project β short name
xunitβ languages[C#],F#,VBβ tagsTest/xUnitβ introduced in1.0 - Razor Component β short name
razorcomponentβ languages[C#]β tagsWeb/ASP.NETβ introduced in3.0 - Razor Page β short name
pageβ languages[C#]β tagsWeb/ASP.NETβ introduced in2.0 - MVC ViewImports β short name
viewimportsβ languages[C#]β tagsWeb/ASP.NETβ introduced in2.0 - MVC ViewStart β short name
viewstartβ languages[C#]β tagsWeb/ASP.NETβ introduced in2.0 - Blazor Server App β short name
blazorserverβ languages[C#]β tagsWeb/Blazorβ introduced in3.0 - Blazor WebAssembly App β short name
blazorwasmβ languages[C#]β tagsWeb/Blazor/WebAssemblyβ introduced in3.1.300 - ASP.NET Core Empty β short name
webβ languages[C#],F#β tagsWeb/Emptyβ introduced in1.0 - ASP.NET Core Web App (Model-View-Controller) β short name
mvcβ languages[C#],F#β tagsWeb/MVCβ introduced in1.0 - ASP.NET Core Web App β short names
webapp,razorβ languages[C#]β tagsWeb/MVC/Razor Pagesβ introduced in2.2,2.0 - ASP.NET Core with Angular β short name
angularβ languages[C#]β tagsWeb/MVC/SPAβ introduced in2.0 - ASP.NET Core with React.js β short name
reactβ languages[C#]β tagsWeb/MVC/SPAβ introduced in2.0 - ASP.NET Core with React.js and Redux β short name
reactreduxβ languages[C#]β tagsWeb/MVC/SPAβ introduced in2.0 - Razor Class Library β short name
razorclasslibβ languages[C#]β tagsWeb/Razor/Library/Razor Class Libraryβ introduced in2.1 - ASP.NET Core Web API β short name
webapiβ languages[C#],F#β tagsWeb/WebAPIβ introduced in1.0 - ASP.NET Core gRPC Service β short name
grpcβ languages[C#]β tagsWeb/gRPCβ introduced in3.0 - dotnet gitignore file β short name
gitignoreβ tagsConfigβ introduced in3.0 - global.json file β short name
globaljsonβ tagsConfigβ introduced in2.0 - NuGet Config β short name
nugetconfigβ tagsConfigβ introduced in1.0 - Dotnet local tool manifest file β short name
tool-manifestβ tagsConfigβ introduced in3.0 - Web Config β short name
webconfigβ tagsConfigβ introduced in1.0 - Solution File β short name
slnβ tagsSolutionβ introduced in1.0 - Protocol Buffer File β short name
protoβ tagsWeb/gRPCβ introduced in3.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 Core3.0SDK.
The following table lists the default values according to the SDK version number you're using:
- SDK version
5.0β default valuenet5.0 - SDK version
3.1β default valuenetcoreapp3.1 - SDK version
3.0β default valuenetcoreapp3.0
The 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 --framework is net5.0. If you install SDK 3.1, the value netcoreapp3.1 becomes available for --framework. If you install SDK 2.1, netcoreapp2.1 becomes available, and so on. So by specifying --framework netcoreapp2.1 you can use SDK 2.1 even while running dotnet new in 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 (https://www.nuget.org/packages?q=Microsoft.DotNet.Common.ProjectTemplates), web (https://www.nuget.org/packages?q=Microsoft.DotNet.Web.ProjectTemplates), and SPA (https://www.nuget.org/packages?q=Microsoft.DotNet.Web.Spa.ProjectTemplates) project types use different packages per target framework moniker (TFM). For example, to create a console project that targets netcoreapp1.0, run dotnet new --install on Microsoft.DotNet.Common.ProjectTemplates.1.x.
--langVersion <VERSION_NUMBER>β Sets theLangVersionproperty in the created project file. For example, use--langVersion 7.3to use C# 7.3. Not supported for F#. Available since .NET Core2.2SDK.
For a list of default C# versions, see Defaults.
--no-restoreβ If specified, doesn't execute an implicit restore during project creation. Available since .NET Core2.2SDK.
π classlib
-f,--framework <FRAMEWORK>β Specifies the framework to target. Values:net5.0ornetcoreapp<version>to create a .NET Class Library ornetstandard<version>to create a .NET Standard Class Library. The default value for .NET5.0SDK isnet5.0.
To create a project that targets a framework earlier than the SDK that you're using, see --framework for console projects earlier in this article.
--langVersion <VERSION_NUMBER>β Sets theLangVersionproperty in the created project file. For example, use--langVersion 7.3to use C# 7.3. Not supported for F#. Available since .NET Core2.2SDK.
For a list of default C# versions, see Defaults.
--no-restoreβ Doesn't execute an implicit restore during project creation.
π¦ wpf, wpflib, wpfcustomcontrollib, wpfusercontrollib
-f,--framework <FRAMEWORK>β Specifies the framework to target. The default value isnet5.0. Available since .NET Core3.1SDK.
To create a project that targets a framework earlier than the SDK that you're using, see --framework for console projects earlier in this article.
--langVersion <VERSION_NUMBER>β Sets theLangVersionproperty 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-restoreβ Doesn't execute an implicit restore during project creation.
π«Ά winforms, winformslib
--langVersion <VERSION_NUMBER>β Sets theLangVersionproperty 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-restoreβ Doesn't execute an implicit restore during project creation.
π worker, grpc
-f,--framework <FRAMEWORK>β Specifies the framework to target. The default value isnetcoreapp3.1. Available since .NET Core3.1SDK.
To create a project that targets a framework earlier than the SDK that you're using, see --framework for console projects earlier in this article.
--exclude-launch-settingsβ ExcludeslaunchSettings.jsonfrom the generated template.--no-restoreβ Doesn't execute an implicit restore during project creation.
β mstest, xunit
-f,--framework <FRAMEWORK>β Specifies the framework to target. Option available since .NET Core3.0SDK.
The following table lists the default values according to the SDK version number you're using:
- SDK version
5.0β default valuenet5.0 - SDK version
3.1β default valuenetcoreapp3.1 - SDK version
3.0β default valuenetcoreapp3.0
To create a project that targets a framework earlier than the SDK that you're using, see --framework for console projects earlier in this article.
-p,--enable-packβ Enables packaging for the project usingdotnet pack.--no-restoreβ Doesn'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
5.0β default valuenet5.0 - SDK version
3.1β default valuenetcoreapp3.1 - SDK version
3.0β default valuenetcoreapp3.0 - SDK version
2.2β default valuenetcoreapp2.2 - SDK version
2.1β default valuenetcoreapp2.1
To create a project that targets a framework earlier than the SDK that you're using, see --framework for console projects earlier in this article.
-p,--enable-pack
bestie the page literally cuts off right here mid-option π part 2 has the rest, keep scrolling energy π«Ά
Enables packaging for the project using dotnet pack. π
--no-restoreβ doesn't run an implicit restore while your project is being created. let it cook on its own, bestie.
π page
-na,--namespace<NAMESPACE_NAME> β the namespace for your generated code. default isMyApp.Namespace.-np,--no-pagemodelβ makes the page without aPageModel. no model, no problem. π
π¦ viewimports, proto
-na,--namespace<NAMESPACE_NAME> β namespace for the generated code. default isMyApp.Namespace. yes, same one, she's consistent. β¨
π₯ blazorserver
-au,--auth<AUTHENTICATION_TYPE> β which flavor of authentication to use. the possible values are:Noneβ no authentication (this is the 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 it withIndividualB2Cauthentication. default ishttps://login.microsoftonline.com/tfp/.-ssp,--susi-policy-id<ID> β the sign-in and sign-up policy ID for this project. use it withIndividualB2Cauthentication.-rp,--reset-password-policy-id<ID> β the reset password policy ID for this project. use it withIndividualB2Cauthentication.-ep,--edit-profile-policy-id<ID> β the edit profile policy ID for this project. use it withIndividualB2Cauthentication.--aad-instance<INSTANCE> β the Azure Active Directory instance to connect to. use it withSingleOrgorMultiOrgauthentication. default ishttps://login.microsoftonline.com/.--client-id<ID> β the Client ID for this project. use it withIndividualB2C,SingleOrg, orMultiOrgauthentication. default is11111111-1111-1111-11111111111111111.--domain<DOMAIN> β the domain for the directory tenant. use it withSingleOrgorIndividualB2Cauthentication. default isqualified.domain.name.--tenant-id<ID> β the TenantId ID of the directory to connect to. use it withSingleOrgauthentication. default is22222222-2222-2222-2222-222222222222.--callback-path<PATH> β the request path within the application's base path of the redirect URI. use it withSingleOrgorIndividualB2Cauthentication. default is/signin-oidc.-r,--org-read-accessβ lets this application have read-access to the directory. only applies toSingleOrgorMultiOrgauthentication.--exclude-launch-settingsβ keepslaunchSettings.jsonout of the generated template. bye bestie π--no-httpsβ turns off HTTPS. this option only applies ifIndividual,IndividualB2C,SingleOrg, orMultiOrgaren't being used for--auth.-uld,--use-local-dbβ says LocalDB should be used instead of SQLite. only applies toIndividualorIndividualB2Cauthentication.--no-restoreβ doesn't execute an implicit restore during project creation.
π blazorwasm
-f,--framework<FRAMEWORK> β picks the framework to target.
the default values depend on which SDK version number you're using:
- SDK version
5.0βnet5.0 - SDK version
3.1βnetcoreapp3.1
to create a project that targets a framework earlier than the SDK you're using, see --framework for console projects earlier in this article.
--no-restoreβ doesn't execute an implicit restore during project creation.-ho,--hostedβ includes 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 (this is the 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 it withIndividualauthentication. default ishttps://login.microsoftonline.com/.--aad-b2c-instance<INSTANCE> β the Azure Active Directory B2C instance to connect to. use it withIndividualB2Cauthentication. default ishttps://aadB2CInstance.b2clogin.com/.-ssp,--susi-policy-id<ID> β the sign-in and sign-up policy ID for this project. use it withIndividualB2Cauthentication.--aad-instance<INSTANCE> β the Azure Active Directory instance to connect to. use it withSingleOrgauthentication. default ishttps://login.microsoftonline.com/.--client-id<ID> β the Client ID for this project. use it withIndividualB2C,SingleOrg, orIndividualauthentication in standalone scenarios. default is33333333-3333-3333-33333333333333333.--domain<DOMAIN> β the domain for the directory tenant. use it withSingleOrgorIndividualB2Cauthentication. default isqualified.domain.name.--app-id-uri<URI> β the App ID Uri for the server API you want to call. use it withSingleOrgorIndividualB2Cauthentication. default isapi.id.uri.--api-client-id<ID> β the Client ID for the API that the server hosts. use it withSingleOrgorIndividualB2Cauthentication. default is11111111-1111-1111-11111111111111111.-s,--default-scope<SCOPE> β the API scope the client needs to request to provision an access token. use it withSingleOrgorIndividualB2Cauthentication. default isuser_impersonation.--tenant-id<ID> β the TenantId ID of the directory to connect to. use it withSingleOrgauthentication. default is22222222-2222-2222-2222-222222222222.-r,--org-read-accessβ lets this application have read-access to the directory. only applies toSingleOrgauthentication.--exclude-launch-settingsβ keepslaunchSettings.jsonout of the generated template.-p,--pwaβ produces a Progressive Web Application (PWA) supporting installation and offline use. offline mode? we love her. π--no-httpsβ turns off HTTPS. this option only applies ifIndividual,IndividualB2C, orSingleOrgaren't being used for--auth.-uld,--use-local-dbβ says LocalDB should be used instead of SQLite. only applies toIndividualorIndividualB2Cauthentication.--called-api-url<URL> β URL of the API to call from the web app. only applies toSingleOrgorIndividualB2Cauthentication without an ASP.NET Core host specified. default ishttps://graph.microsoft.com/v1.0/me.--calls-graphβ specifies if the web app calls Microsoft Graph. only applies toSingleOrgauthentication.--called-api-scopes<SCOPES> β scopes to request to call the API from the web app. only applies toSingleOrgorIndividualB2Cauthentication without an ASP.NET Core host specified. default isuser.read.
πΈ web
--exclude-launch-settingsβ keepslaunchSettings.jsonout of the generated template.-f,--framework<FRAMEWORK> β picks the framework to target. this option isn't available in the .NET Core 2.2 SDK.
the default values depend on which SDK version number you're using:
- SDK version
5.0βnet5.0 - SDK version
3.1βnetcoreapp3.1 - SDK version
3.0βnetcoreapp3.0 - SDK version
2.1βnetcoreapp2.1
to create a project that targets a framework earlier than the SDK you're using, see --framework for console projects earlier in this article.
--no-restoreβ doesn't execute an implicit restore during project creation.--no-httpsβ turns off HTTPS.
π mvc, webapp
-au,--auth<AUTHENTICATION_TYPE> β the type of authentication to use. the possible values are:Noneβ no authentication (this is the 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 it withIndividualB2Cauthentication. default ishttps://login.microsoftonline.com/tfp/.-ssp,--susi-policy-id<ID> β the sign-in and sign-up policy ID for this project. use it withIndividualB2Cauthentication.-rp,--reset-password-policy-id<ID> β the reset password policy ID for this project. use it withIndividualB2Cauthentication.-ep,--edit-profile-policy-id<ID> β the edit profile policy ID for this project. use it withIndividualB2Cauthentication.--aad-instance<INSTANCE> β the Azure Active Directory instance to connect to. use it withSingleOrgorMultiOrgauthentication. default ishttps://login.microsoftonline.com/.--client-id<ID> β the Client ID for this project. use it withIndividualB2C,SingleOrg, orMultiOrgauthentication. default is11111111-1111-1111-11111111111111111.--domain<DOMAIN> β the domain for the directory tenant. use it withSingleOrgorIndividualB2Cauthentication. default isqualified.domain.name.--tenant-id<ID> β the TenantId ID of the directory to connect to. use it withSingleOrgauthentication. default is22222222-2222-2222-2222-222222222222.--callback-path<PATH> β the request path within the application's base path of the redirect URI. use it withSingleOrgorIndividualB2Cauthentication. default is/signin-oidc.-r,--org-read-accessβ lets this application have read-access to the directory. only applies toSingleOrgorMultiOrgauthentication.--exclude-launch-settingsβ keepslaunchSettings.jsonout of the generated template.--no-httpsβ turns off HTTPS. this option only applies ifIndividual,IndividualB2C,SingleOrg, orMultiOrgaren't being used.-uld,--use-local-db
Specifies LocalDB should be used instead of SQLite. Only applies to Individual or IndividualB2C authentication.
-f,--framework <FRAMEWORK>β picks the framework you wanna target, bestie. option's been around since .NET Core 3.0 SDK.
the defaults are literally:
- SDK
5.0βnet5.0 - SDK
3.1βnetcoreapp3.1 - SDK
3.0βnetcoreapp3.0
wanna target something older than the SDK you're on? see --framework for console projects earlier in this article. periodt.
--no-restoreβ doesnβt execute an implicit restore during project creation.--use-browserlinkβ drops BrowserLink into the project. heads up: not available in .NET Core 2.2 and 3.1 SDK. π-rrc,--razor-runtime-compilationβ decides if the project gets Razor runtime compilation in Debug builds. available since .NET Core 3.1.201 SDK. slay.
π angular, react π
-au,--auth <AUTHENTICATION_TYPE>β the type of auth to use. available since .NET Core 3.0 SDK.
possible values:
Noneβ no authentication (default).Individualβ individual authentication.
--exclude-launch-settingsβ keepslaunchSettings.jsonout of the generated template.--no-restoreβ doesnβt execute an implicit restore during project creation.--no-httpsβ turns off HTTPS. this option only applies if authentication isNone.-uld,--use-local-dbβ says LocalDB should be used instead of SQLite. only applies toIndividualorIndividualB2Cauthentication. available since .NET Core 3.0 SDK.-f,--framework <FRAMEWORK>β specifies the framework to target. option not available in .NET Core 2.2 SDK.
defaults:
5.0βnet5.03.1βnetcoreapp3.13.0βnetcoreapp3.02.1βnetcoreapp2.0
for earlier targets, see --framework for console projects earlier in this article.
βοΈ reactredux βοΈ
--exclude-launch-settingsβ excludeslaunchSettings.jsonfrom the generated template.-f,--framework <FRAMEWORK>β specifies the framework to target. option not available in .NET Core 2.2 SDK.
defaults:
5.0βnet5.03.1βnetcoreapp3.13.0βnetcoreapp3.02.1βnetcoreapp2.0
for earlier targets, see --framework for console projects earlier in this article.
--no-restoreβ doesnβt execute an implicit restore during project creation.--no-httpsβ turns off HTTPS.
π§© razorclasslib π§©
--no-restoreβ doesnβt execute an implicit restore during project creation.-s,--support-pages-and-viewsβ supports 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. possible values: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 withIndividualB2Cauthentication. 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 withIndividualB2Cauthentication.--aad-instance <INSTANCE>β the Azure Active Directory instance to connect to. use withSingleOrgauthentication. the default value ishttps://login.microsoftonline.com/.--client-id <ID>β the Client ID for this project. use withIndividualB2CorSingleOrgauthentication. the default value is11111111-1111-1111-11111111111111111.--domain <DOMAIN>β the domain for the directory tenant. use withIndividualB2CorSingleOrgauthentication. the default value isqualified.domain.name.--tenant-id <ID>β the TenantId ID of the directory to connect to. use withSingleOrgauthentication. the default value is22222222-2222-2222-2222-222222222222.-r,--org-read-accessβ allows this application read-access to the directory. only applies toSingleOrgauthentication.--exclude-launch-settingsβ excludeslaunchSettings.jsonfrom the generated template.--no-httpsβ turns off HTTPS.app.UseHstsandapp.UseHttpsRedirectionarenβt added toStartup.Configure. this option only applies ifIndividualB2CorSingleOrgarenβt being used for authentication.-uld,--use-local-dbβ specifies LocalDB should be used instead of SQLite. only applies toIndividualB2Cauthentication.-f,--framework <FRAMEWORK>β specifies the framework to target. option not available in .NET Core 2.2 SDK.
defaults:
5.0βnet5.03.1βnetcoreapp3.13.0βnetcoreapp3.02.1βnetcoreapp2.1
for earlier targets, see --framework for console projects earlier in this article.
--no-restoreβ doesnβt execute an implicit restore during project creation.
π globaljson π
--sdk-version <VERSION_NUMBER>β specifies the version of the .NET SDK to use in theglobal.jsonfile.
See also
dotnet newcommanddotnet new βlistoption- Custom templates for
dotnet new - Create a custom template for
dotnet new
and that's the whole page, bestie! the footer's got the source/version and date, but we're not copying it β just know it's there. mwah πβ¨
π¦ where this page comes from
- ubuntu jammy: dotnet-host 6.0.135-0ubuntu1~22.04.1 Β· MIT
- ubuntu jammy: dotnet-host 6.0.136-0ubuntu1~22.04.1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms