1dotnet new command(1) .NET Core dotnet new command(1)
2
3
4
7 dotnet new - Creates a new project, configuration file, or solution
8 based on the specified template.
9
11 .NET Core 2.2
12 dotnet new <TEMPLATE> [--dry-run] [--force] [-i|--install] [-lang|--language] [-n|--name] [--nuget-source] [-o|--output] [-u|--uninstall] [Template options]
13 dotnet new <TEMPLATE> [-l|--list] [--type]
14 dotnet new [-h|--help]
15
16 .NET Core 2.1
17 dotnet new <TEMPLATE> [--force] [-i|--install] [-lang|--language] [-n|--name] [--nuget-source] [-o|--output] [-u|--uninstall] [Template options]
18 dotnet new <TEMPLATE> [-l|--list] [--type]
19 dotnet new [-h|--help]
20
21 .NET Core 2.0
22 dotnet new <TEMPLATE> [--force] [-i|--install] [-lang|--language] [-n|--name] [-o|--output] [-u|--uninstall] [Template options]
23 dotnet new <TEMPLATE> [-l|--list] [--type]
24 dotnet new [-h|--help]
25
26 .NET Core 1.x
27 dotnet new <TEMPLATE> [-lang|--language] [-n|--name] [-o|--output] [-all|--show-all] [-h|--help] [Template options]
28 dotnet new <TEMPLATE> [-l|--list]
29 dotnet new [-all|--show-all]
30 dotnet new [-h|--help]
31
32 * * * * *
33
35 The dotnet new command provides a convenient way to initialize a valid
36 .NET Core project.
37
38 The command calls the template engine to create the artifacts on disk
39 based on the specified template and options.
40
41 Arguments
42 TEMPLATE
43
44 The template to instantiate when the command is invoked. Each template
45 might have specific options you can pass. For more information, see
46 Template options.
47
48 If the TEMPLATE value isn’t an exact match on text in the Templates or
49 Short Name column, a substring match is performed on those two columns.
50
51 .NET Core 2.2
52 The command contains a default list of templates. Use dotnet new -l to
53 obtain a list of the available templates. The following table shows
54 the templates that come pre-installed with the .NET Core SDK 2.2.100.
55 The default language for the template is shown inside the brackets.
56
57 Templates Short Name Language Tags
58 ─────────────────────────────────────────────────────────────────
59 Console Applica‐ console [C#], F#, VB Common/Console
60 tion
61 Class library classlib [C#], F#, VB Common/Library
62 Unit Test mstest [C#], F#, VB Test/MSTest
63 Project
64 NUnit 3 Test nunit [C#], F#, VB Test/NUnit
65 Project
66
67 NUnit 3 Test nunit-test [C#], F#, VB Test/NUnit
68 Item
69 xUnit Test xunit [C#], F#, VB Test/xUnit
70 Project
71 Razor Page page [C#] Web/ASP.NET
72 MVC ViewImports viewimports [C#] Web/ASP.NET
73 MVC ViewStart viewstart [C#] Web/ASP.NET
74 ASP.NET Core web [C#], F# Web/Empty
75 Empty
76 ASP.NET Core Web mvc [C#], F# Web/MVC
77 App (Model-View-
78 Controller)
79 ASP.NET Core Web webapp, razor [C#] Web/MVC/Razor
80 App Pages
81 ASP.NET Core angular [C#] Web/MVC/SPA
82 with Angular
83 ASP.NET Core react [C#] Web/MVC/SPA
84 with React.js
85 ASP.NET Core reactredux [C#] Web/MVC/SPA
86 with React.js
87 and Redux
88 Razor Class Li‐ razorclasslib [C#] Web/Razor/Li‐
89 brary brary/Razor
90 Class Library
91 ASP.NET Core Web webapi [C#], F# Web/WebAPI
92 API
93 global.json file globaljson Config
94 NuGet Config nugetconfig Config
95 Web Config webconfig Config
96 Solution File sln Solution
97
98 .NET Core 2.1
99 The command contains a default list of templates. Use dotnet new -l to
100 obtain a list of the available templates. The following table shows
101 the templates that come pre-installed with the .NET Core SDK 2.1.300.
102 The default language for the template is shown inside the brackets.
103
104 Templates Short Name Language Tags
105 ─────────────────────────────────────────────────────────────────
106 Console Applica‐ console [C#], F#, VB Common/Console
107 tion
108 Class library classlib [C#], F#, VB Common/Library
109 Unit Test mstest [C#], F#, VB Test/MSTest
110 Project
111 xUnit Test xunit [C#], F#, VB Test/xUnit
112 Project
113 Razor Page page [C#] Web/ASP.NET
114 MVC ViewImports viewimports [C#] Web/ASP.NET
115 MVC ViewStart viewstart [C#] Web/ASP.NET
116 ASP.NET Core web [C#], F# Web/Empty
117 Empty
118 ASP.NET Core Web mvc [C#], F# Web/MVC
119 App (Model-View-
120 Controller)
121 ASP.NET Core Web razor [C#] Web/MVC/Razor
122 App Pages
123 ASP.NET Core angular [C#] Web/MVC/SPA
124 with Angular
125 ASP.NET Core react [C#] Web/MVC/SPA
126 with React.js
127 ASP.NET Core reactredux [C#] Web/MVC/SPA
128 with React.js
129 and Redux
130
131
132
133 Razor Class Li‐ razorclasslib [C#] Web/Razor/Li‐
134 brary brary/Razor
135 Class Library
136 ASP.NET Core Web webapi [C#], F# Web/WebAPI
137 API
138 global.json file globaljson Config
139 NuGet Config nugetconfig Config
140 Web Config webconfig Config
141 Solution File sln Solution
142
143 .NET Core 2.0
144 The command contains a default list of templates. Use dotnet new -l to
145 obtain a list of the available templates. The following table shows
146 the templates that come pre-installed with the .NET Core SDK 2.0.0.
147 The default language for the template is shown inside the brackets.
148
149 Templates Short Name Language Tags
150 ───────────────────────────────────────────────────────────────
151 Console Applica‐ console [C#], F#, VB Common/Console
152 tion
153 Class library classlib [C#], F#, VB Common/Library
154 Unit Test mstest [C#], F#, VB Test/MSTest
155 Project
156 xUnit Test xunit [C#], F#, VB Test/xUnit
157 Project
158 ASP.NET Core web [C#], F# Web/Empty
159 Empty
160 ASP.NET Core Web mvc [C#], F# Web/MVC
161 App (Model-View-
162 Controller)
163 ASP.NET Core Web razor [C#] Web/MVC/Razor
164 App Pages
165 ASP.NET Core angular [C#] Web/MVC/SPA
166 with Angular
167 ASP.NET Core react [C#] Web/MVC/SPA
168 with React.js
169 ASP.NET Core reactredux [C#] Web/MVC/SPA
170 with React.js
171 and Redux
172 ASP.NET Core Web webapi [C#], F# Web/WebAPI
173 API
174 global.json file globaljson Config
175 Nuget Config nugetconfig Config
176 Web Config webconfig Config
177 Solution File sln Solution
178 Razor Page page Web/ASP.NET
179 MVC ViewImports viewimports Web/ASP.NET
180 MVC ViewStart viewstart Web/ASP.NET
181
182 .NET Core 1.x
183 The command contains a default list of templates. Use dotnet new -all
184 to obtain a list of the available templates. The following table shows
185 the templates that come pre-installed with the .NET Core SDK 1.0.1.
186 The default language for the template is shown inside the brackets.
187
188 Templates Short Name Language Tags
189 ───────────────────────────────────────────────────────────
190 Console Applica‐ console [C#], F# Common/Console
191 tion
192 Class library classlib [C#], F# Common/Library
193 Unit Test mstest [C#], F# Test/MSTest
194 Project
195 xUnit Test xunit [C#], F# Test/xUnit
196 Project
197
198
199 ASP.NET Core web [C#] Web/Empty
200 Empty
201 ASP.NET Core Web mvc [C#], F# Web/MVC
202 App
203 ASP.NET Core Web webapi [C#] Web/WebAPI
204 API
205 Nuget Config nugetconfig Config
206 Web Config webconfig Config
207 Solution File sln Solution
208
209 * * * * *
210
212 .NET Core 2.2
213 --dry-run
214
215 Displays a summary of what would happen if the given command were run
216 if it would result in a template creation.
217
218 --force
219
220 Forces content to be generated even if it would change existing files.
221 This is required when the output directory already contains a project.
222
223 -h|--help
224
225 Prints out help for the command. It can be invoked for the dotnet new
226 command itself or for any template, such as dotnet new mvc --help.
227
228 -i|--install <PATH|NUGET_ID>
229
230 Installs a source or template pack from the PATH or NUGET_ID provided.
231 If you want to install a prerelease version of a template package, you
232 need to specify the version in the format of <package-name>::<package-
233 version>. By default, dotnet new passes * for the version, which rep‐
234 resents the last stable package version. See an example at the Exam‐
235 ples section.
236
237 For information on creating custom templates, see Custom templates for
238 dotnet new.
239
240 -l|--list
241
242 Lists templates containing the specified name. If invoked for the dot‐
243 net new command, it lists the possible templates available for the giv‐
244 en directory. For example if the directory already contains a project,
245 it doesn’t list all project templates.
246
247 -lang|--language {C#|F#|VB}
248
249 The language of the template to create. The language accepted varies
250 by the template (see defaults in the arguments section). Not valid for
251 some templates.
252
253 [!NOTE] Some shells interpret # as a special character. In
254 those cases, you need to enclose the language parameter value,
255 such as dotnet new console -lang "F#".
256
257 -n|--name <OUTPUT_NAME>
258
259 The name for the created output. If no name is specified, the name of
260 the current directory is used.
261
262 --nuget-source
263
264 Specifies a NuGet source to use during install.
265
266 -o|--output <OUTPUT_DIRECTORY>
267
268 Location to place the generated output. The default is the current di‐
269 rectory.
270
271 --type
272
273 Filters templates based on available types. Predefined values are
274 “project”, “item”, or “other”.
275
276 -u|--uninstall <PATH|NUGET_ID>
277
278 Uninstalls a source or template pack at the PATH or NUGET_ID provided.
279 When excluding the <PATH|NUGET_ID> value, all currently installed tem‐
280 plate packs and their associated templates are displayed.
281
282 [!NOTE] To uninstall a template using a PATH, you need to fully
283 qualify the path. For example, C:/Users/<USER>/Documents/Tem‐
284 plates/GarciaSoftware.ConsoleTemplate.CSharp will work, but
285 ./GarciaSoftware.ConsoleTemplate.CSharp from the containing
286 folder will not. Additionally, do not include a final terminat‐
287 ing directory slash on your template path.
288
289 .NET Core 2.1
290 --force
291
292 Forces content to be generated even if it would change existing files.
293 This is required when the output directory already contains a project.
294
295 -h|--help
296
297 Prints out help for the command. It can be invoked for the dotnet new
298 command itself or for any template, such as dotnet new mvc --help.
299
300 -i|--install <PATH|NUGET_ID>
301
302 Installs a source or template pack from the PATH or NUGET_ID provided.
303 If you want to install a prerelease version of a template package, you
304 need to specify the version in the format of <package-name>::<package-
305 version>. By default, dotnet new passes * for the version, which rep‐
306 resents the last stable package version. See an example at the Exam‐
307 ples section.
308
309 For information on creating custom templates, see Custom templates for
310 dotnet new.
311
312 -l|--list
313
314 Lists templates containing the specified name. If invoked for the dot‐
315 net new command, it lists the possible templates available for the giv‐
316 en directory. For example if the directory already contains a project,
317 it doesn’t list all project templates.
318
319 -lang|--language {C#|F#|VB}
320
321 The language of the template to create. The language accepted varies
322 by the template (see defaults in the arguments section). Not valid for
323 some templates.
324
325 [!NOTE] Some shells interpret # as a special character. In
326 those cases, you need to enclose the language parameter value,
327 such as dotnet new console -lang "F#".
328
329 -n|--name <OUTPUT_NAME>
330
331 The name for the created output. If no name is specified, the name of
332 the current directory is used.
333
334 --nuget-source
335
336 Specifies a NuGet source to use during install.
337
338 -o|--output <OUTPUT_DIRECTORY>
339
340 Location to place the generated output. The default is the current di‐
341 rectory.
342
343 --type
344
345 Filters templates based on available types. Predefined values are
346 “project”, “item” or “other”.
347
348 -u|--uninstall <PATH|NUGET_ID>
349
350 Uninstalls a source or template pack at the PATH or NUGET_ID provided.
351
352 [!NOTE] To uninstall a template using a PATH, you need to fully
353 qualify the path. For example, C:/Users/<USER>/Documents/Tem‐
354 plates/GarciaSoftware.ConsoleTemplate.CSharp will work, but
355 ./GarciaSoftware.ConsoleTemplate.CSharp from the containing
356 folder will not. Additionally, do not include a final terminat‐
357 ing directory slash on your template path.
358
359 .NET Core 2.0
360 --force
361
362 Forces content to be generated even if it would change existing files.
363 This is required when the output directory already contains a project.
364
365 -h|--help
366
367 Prints out help for the command. It can be invoked for the dotnet new
368 command itself or for any template, such as dotnet new mvc --help.
369
370 -i|--install <PATH|NUGET_ID>
371
372 Installs a source or template pack from the PATH or NUGET_ID provided.
373 If you want to install a prerelease version of a template package, you
374 need to specify the version in the format of <package-name>::<package-
375 version>. By default, dotnet new passes * for the version, which rep‐
376 resents the last stable package version. See an example at the Exam‐
377 ples section.
378
379 For information on creating custom templates, see Custom templates for
380 dotnet new.
381
382 -l|--list
383
384 Lists templates containing the specified name. If invoked for the dot‐
385 net new command, it lists the possible templates available for the giv‐
386 en directory. For example if the directory already contains a project,
387 it doesn’t list all project templates.
388
389 -lang|--language {C#|F#|VB}
390
391 The language of the template to create. The language accepted varies
392 by the template (see defaults in the arguments section). Not valid for
393 some templates.
394
395 [!NOTE] Some shells interpret # as a special character. In
396 those cases, you need to enclose the language parameter value,
397 such as dotnet new console -lang "F#".
398
399 -n|--name <OUTPUT_NAME>
400
401 The name for the created output. If no name is specified, the name of
402 the current directory is used.
403
404 -o|--output <OUTPUT_DIRECTORY>
405
406 Location to place the generated output. The default is the current di‐
407 rectory.
408
409 --type
410
411 Filters templates based on available types. Predefined values are
412 “project”, “item” or “other”.
413
414 -u|--uninstall <PATH|NUGET_ID>
415
416 Uninstalls a source or template pack at the PATH or NUGET_ID provided.
417
418 [!NOTE] To uninstall a template using a source PATH, you need to
419 fully qualify the path. For example, C:/Users/<USER>/Docu‐
420 ments/Templates/GarciaSoftware.ConsoleTemplate.CSharp will work,
421 but ./GarciaSoftware.ConsoleTemplate.CSharp from the containing
422 folder will not. Additionally, do not include a final terminat‐
423 ing directory slash on your template path.
424
425 If you are unable to determine the PATH or NUGET_ID argument
426 needed to uninstall a template, running dotnet new --uninstall
427 without an argument will list all installed templates and the
428 argument required to uninstall them.
429
430 .NET Core 1.x
431 -all|--show-all
432
433 Shows all templates for a specific type of project when running in the
434 context of the dotnet new command alone. When running in the context
435 of a specific template, such as dotnet new web -all, -all is interpret‐
436 ed as a force creation flag. This is required when the output directo‐
437 ry already contains a project.
438
439 -h|--help
440
441 Prints out help for the command. It can be invoked for the dotnet new
442 command itself or for any template, such as dotnet new mvc --help.
443
444 -l|--list
445
446 Lists templates containing the specified name. If invoked for the dot‐
447 net new command, it lists the possible templates available for the giv‐
448 en directory. For example if the directory already contains a project,
449 it doesn’t list all project templates.
450
451 -lang|--language {C#|F#}
452
453 The language of the template to create. The language accepted varies
454 by the template (see defaults in the arguments section). Not valid for
455 some templates.
456
457 [!NOTE] Some shells interpret # as a special character. In
458 those cases, you need to enclose the language parameter value,
459 such as dotnet new console -lang "F#".
460
461 -n|--name <OUTPUT_NAME>
462
463 The name for the created output. If no name is specified, the name of
464 the current directory is used.
465
466 -o|--output <OUTPUT_DIRECTORY>
467
468 Location to place the generated output. The default is the current di‐
469 rectory.
470
471 * * * * *
472
473 Template options
474 Each project template may have additional options available. The core
475 templates have the following additional options:
476
477 .NET Core 2.2
478 console
479
480 --langVersion <VERSION_NUMBER> - Sets the LangVersion property in the
481 created project file. For example, use --langVersion 7.3 to use C#
482 7.3. Not supported for F#.
483
484 --no-restore - Doesn’t execute an implicit restore during project cre‐
485 ation.
486
487 angular, react, reactredux
488
489 --exclude-launch-settings - Exclude launchSettings.json from the gener‐
490 ated template.
491
492 --no-restore - Doesn’t execute an implicit restore during project cre‐
493 ation.
494
495 --no-https - Project doesn’t require HTTPS. This option only applies
496 if IndividualAuth or OrganizationalAuth are not being used.
497
498 razorclasslib
499
500 --no-restore - Doesn’t execute an implicit restore during project cre‐
501 ation.
502
503 classlib
504
505 -f|--framework <FRAMEWORK> - Specifies the framework to target. Val‐
506 ues: netcoreapp2.2 to create a .NET Core Class Library or netstan‐
507 dard2.0 to create a .NET Standard Class Library. The default value is
508 netstandard2.0.
509
510 --langVersion <VERSION_NUMBER> - Sets the LangVersion property in the
511 created project file. For example, use --langVersion 7.3 to use C#
512 7.3. Not supported for F#.
513
514 --no-restore - Doesn’t execute an implicit restore during project cre‐
515 ation.
516
517 mstest, xunit
518
519 -p|--enable-pack - Enables packaging for the project using dotnet pack.
520
521 --no-restore - Doesn’t execute an implicit restore during project cre‐
522 ation.
523
524 nunit
525
526 -f|--framework <FRAMEWORK> - Specifies the framework to target. The
527 default value is netcoreapp2.1.
528
529 -p|--enable-pack - Enables packaging for the project using dotnet pack.
530
531 --no-restore - Doesn’t execute an implicit restore during project cre‐
532 ation.
533
534 page
535
536 -na|--namespace <NAMESPACE_NAME> - Namespace for the generated code.
537 The default value is MyApp.Namespace.
538
539 -np|--no-pagemodel - Creates the page without a PageModel.
540
541 viewimports
542
543 -na|--namespace <NAMESPACE_NAME> - Namespace for the generated code.
544 The default value is MyApp.Namespace.
545
546 web
547
548 --exclude-launch-settings - Exclude launchSettings.json from the gener‐
549 ated template.
550
551 --no-restore - Doesn’t execute an implicit restore during project cre‐
552 ation.
553
554 --no-https - Project doesn’t require HTTPS. This option only applies
555 if IndividualAuth or OrganizationalAuth are not being used.
556
557 mvc, webapp
558
559 -au|--auth <AUTHENTICATION_TYPE> - The type of authentication to use.
560 The possible values are:
561
562 · None - No authentication (Default).
563
564 · Individual - Individual authentication.
565
566 · IndividualB2C - Individual authentication with Azure AD B2C.
567
568 · SingleOrg - Organizational authentication for a single tenant.
569
570 · MultiOrg - Organizational authentication for multiple tenants.
571
572 · Windows - Windows authentication.
573
574 --aad-b2c-instance <INSTANCE> - The Azure Active Directory B2C instance
575 to connect to. Use with IndividualB2C authentication. The default
576 value is https://login.microsoftonline.com/tfp/.
577
578 -ssp|--susi-policy-id <ID> - The sign-in and sign-up policy ID for this
579 project. Use with IndividualB2C authentication.
580
581 -rp|--reset-password-policy-id <ID> - The reset password policy ID for
582 this project. Use with IndividualB2C authentication.
583
584 -ep|--edit-profile-policy-id <ID> - The edit profile policy ID for this
585 project. Use with IndividualB2C authentication.
586
587 --aad-instance <INSTANCE> - The Azure Active Directory instance to con‐
588 nect to. Use with SingleOrg or MultiOrg authentication. The default
589 value is https://login.microsoftonline.com/.
590
591 --client-id <ID> - The Client ID for this project. Use with Individu‐
592 alB2C, SingleOrg, or MultiOrg authentication. The default value is
593 11111111-1111-1111-11111111111111111.
594
595 --domain <DOMAIN> - The domain for the directory tenant. Use with Sin‐
596 gleOrg or IndividualB2C authentication. The default value is quali‐
597 fied.domain.name.
598
599 --tenant-id <ID> - The TenantId ID of the directory to connect to. Use
600 with SingleOrg authentication. The default value is
601 22222222-2222-2222-2222-222222222222.
602
603 --callback-path <PATH> - The request path within the application’s base
604 path of the redirect URI. Use with SingleOrg or IndividualB2C authen‐
605 tication. The default value is /signin-oidc.
606
607 -r|--org-read-access - Allows this application read-access to the di‐
608 rectory. Only applies to SingleOrg or MultiOrg authentication.
609
610 --exclude-launch-settings - Exclude launchSettings.json from the gener‐
611 ated template.
612
613 --no-https - Project doesn’t require HTTPS. app.UseHsts and app.Use‐
614 HttpsRedirection aren’t added to Startup.Configure. This option only
615 applies if Individual, IndividualB2C, SingleOrg, or MultiOrg aren’t be‐
616 ing used.
617
618 -uld|--use-local-db - Specifies LocalDB should be used instead of
619 SQLite. Only applies to Individual or IndividualB2C authentication.
620
621 --no-restore - Doesn’t execute an implicit restore during project cre‐
622 ation.
623
624 webapi
625
626 -au|--auth <AUTHENTICATION_TYPE> - The type of authentication to use.
627 The possible values are:
628
629 · None - No authentication (Default).
630
631 · IndividualB2C - Individual authentication with Azure AD B2C.
632
633 · SingleOrg - Organizational authentication for a single tenant.
634
635 · Windows - Windows authentication.
636
637 --aad-b2c-instance <INSTANCE> - The Azure Active Directory B2C instance
638 to connect to. Use with IndividualB2C authentication. The default
639 value is https://login.microsoftonline.com/tfp/.
640
641 -ssp|--susi-policy-id <ID> - The sign-in and sign-up policy ID for this
642 project. Use with IndividualB2C authentication.
643
644 --aad-instance <INSTANCE> - The Azure Active Directory instance to con‐
645 nect to. Use with SingleOrg authentication. The default value is
646 https://login.microsoftonline.com/.
647
648 --client-id <ID> - The Client ID for this project. Use with Individu‐
649 alB2C or SingleOrg authentication. The default value is
650 11111111-1111-1111-11111111111111111.
651
652 --domain <DOMAIN> - The domain for the directory tenant. Use with Sin‐
653 gleOrg or IndividualB2C authentication. The default value is quali‐
654 fied.domain.name.
655
656 --tenant-id <ID> - The TenantId ID of the directory to connect to. Use
657 with SingleOrg authentication. The default value is
658 22222222-2222-2222-2222-222222222222.
659
660 -r|--org-read-access - Allows this application read-access to the di‐
661 rectory. Only applies to SingleOrg or MultiOrg authentication.
662
663 --exclude-launch-settings - Exclude launchSettings.json from the gener‐
664 ated template.
665
666 --no-https - Project doesn’t require HTTPS. app.UseHsts and app.Use‐
667 HttpsRedirection aren’t added to Startup.Configure. This option only
668 applies if Individual, IndividualB2C, SingleOrg, or MultiOrg aren’t be‐
669 ing used.
670
671 -uld|--use-local-db - Specifies LocalDB should be used instead of
672 SQLite. Only applies to Individual or IndividualB2C authentication.
673
674 --no-restore - Doesn’t execute an implicit restore during project cre‐
675 ation.
676
677 globaljson
678
679 --sdk-version <VERSION_NUMBER> - Specifies the version of the .NET Core
680 SDK to use in the global.json file.
681
682 .NET Core 2.1
683 console, angular, react, reactredux, razorclasslib
684
685 --no-restore - Doesn’t execute an implicit restore during project cre‐
686 ation.
687
688 classlib
689
690 -f|--framework <FRAMEWORK> - Specifies the framework to target. Val‐
691 ues: netcoreapp2.1 to create a .NET Core Class Library or netstan‐
692 dard2.0 to create a .NET Standard Class Library. The default value is
693 netstandard2.0.
694
695 --no-restore - Doesn’t execute an implicit restore during project cre‐
696 ation.
697
698 mstest, xunit
699
700 -p|--enable-pack - Enables packaging for the project using dotnet pack.
701
702 --no-restore - Doesn’t execute an implicit restore during project cre‐
703 ation.
704
705 globaljson
706
707 --sdk-version <VERSION_NUMBER> - Specifies the version of the .NET Core
708 SDK to use in the global.json file.
709
710 web
711
712 --exclude-launch-settings - Exclude launchSettings.json from the gener‐
713 ated template.
714
715 --no-restore - Doesn’t execute an implicit restore during project cre‐
716 ation.
717
718 --no-https - Project doesn’t require HTTPS. This option only applies
719 if IndividualAuth or OrganizationalAuth are not being used.
720
721 webapi
722
723 -au|--auth <AUTHENTICATION_TYPE> - The type of authentication to use.
724 The possible values are:
725
726 · None - No authentication (Default).
727
728 · IndividualB2C - Individual authentication with Azure AD B2C.
729
730 · SingleOrg - Organizational authentication for a single tenant.
731
732 · Windows - Windows authentication.
733
734 --aad-b2c-instance <INSTANCE> - The Azure Active Directory B2C instance
735 to connect to. Use with IndividualB2C authentication. The default
736 value is https://login.microsoftonline.com/tfp/.
737
738 -ssp|--susi-policy-id <ID> - The sign-in and sign-up policy ID for this
739 project. Use with IndividualB2C authentication.
740
741 --aad-instance <INSTANCE> - The Azure Active Directory instance to con‐
742 nect to. Use with SingleOrg authentication. The default value is
743 https://login.microsoftonline.com/.
744
745 --client-id <ID> - The Client ID for this project. Use with Individu‐
746 alB2C or SingleOrg authentication. The default value is
747 11111111-1111-1111-11111111111111111.
748
749 --domain <DOMAIN> - The domain for the directory tenant. Use with Sin‐
750 gleOrg or IndividualB2C authentication. The default value is quali‐
751 fied.domain.name.
752
753 --tenant-id <ID> - The TenantId ID of the directory to connect to. Use
754 with SingleOrg authentication. The default value is
755 22222222-2222-2222-2222-222222222222.
756
757 -r|--org-read-access - Allows this application read-access to the di‐
758 rectory. Only applies to SingleOrg or MultiOrg authentication.
759
760 --exclude-launch-settings - Exclude launchSettings.json from the gener‐
761 ated template.
762
763 -uld|--use-local-db - Specifies LocalDB should be used instead of
764 SQLite. Only applies to Individual or IndividualB2C authentication.
765
766 --no-restore - Doesn’t execute an implicit restore during project cre‐
767 ation.
768
769 --no-https - Project doesn’t require HTTPS. app.UseHsts and app.Use‐
770 HttpsRedirection aren’t added to Startup.Configure. This option only
771 applies if Individual, IndividualB2C, SingleOrg, or MultiOrg aren’t be‐
772 ing used.
773
774 mvc, razor
775
776 -au|--auth <AUTHENTICATION_TYPE> - The type of authentication to use.
777 The possible values are:
778
779 · None - No authentication (Default).
780
781 · Individual - Individual authentication.
782
783 · IndividualB2C - Individual authentication with Azure AD B2C.
784
785 · SingleOrg - Organizational authentication for a single tenant.
786
787 · MultiOrg - Organizational authentication for multiple tenants.
788
789 · Windows - Windows authentication.
790
791 --aad-b2c-instance <INSTANCE> - The Azure Active Directory B2C instance
792 to connect to. Use with IndividualB2C authentication. The default
793 value is https://login.microsoftonline.com/tfp/.
794
795 -ssp|--susi-policy-id <ID> - The sign-in and sign-up policy ID for this
796 project. Use with IndividualB2C authentication.
797
798 -rp|--reset-password-policy-id <ID> - The reset password policy ID for
799 this project. Use with IndividualB2C authentication.
800
801 -ep|--edit-profile-policy-id <ID> - The edit profile policy ID for this
802 project. Use with IndividualB2C authentication.
803
804 --aad-instance <INSTANCE> - The Azure Active Directory instance to con‐
805 nect to. Use with SingleOrg or MultiOrg authentication. The default
806 value is https://login.microsoftonline.com/.
807
808 --client-id <ID> - The Client ID for this project. Use with Individu‐
809 alB2C, SingleOrg, or MultiOrg authentication. The default value is
810 11111111-1111-1111-11111111111111111.
811
812 --domain <DOMAIN> - The domain for the directory tenant. Use with Sin‐
813 gleOrg or IndividualB2C authentication. The default value is quali‐
814 fied.domain.name.
815
816 --tenant-id <ID> - The TenantId ID of the directory to connect to. Use
817 with SingleOrg authentication. The default value is
818 22222222-2222-2222-2222-222222222222.
819
820 --callback-path <PATH> - The request path within the application’s base
821 path of the redirect URI. Use with SingleOrg or IndividualB2C authen‐
822 tication. The default value is /signin-oidc.
823
824 -r|--org-read-access - Allows this application read-access to the di‐
825 rectory. Only applies to SingleOrg or MultiOrg authentication.
826
827 --exclude-launch-settings - Exclude launchSettings.json from the gener‐
828 ated template.
829
830 --use-browserlink - Includes BrowserLink in the project.
831
832 -uld|--use-local-db - Specifies LocalDB should be used instead of
833 SQLite. Only applies to Individual or IndividualB2C authentication.
834
835 --no-restore - Doesn’t execute an implicit restore during project cre‐
836 ation.
837
838 --no-https - Project doesn’t require HTTPS. app.UseHsts and app.Use‐
839 HttpsRedirection aren’t added to Startup.Configure. This option only
840 applies if Individual, IndividualB2C, SingleOrg, or MultiOrg aren’t be‐
841 ing used.
842
843 page
844
845 -na|--namespace <NAMESPACE_NAME> - Namespace for the generated code.
846 The default value is MyApp.Namespace.
847
848 -np|--no-pagemodel - Creates the page without a PageModel.
849
850 viewimports
851
852 -na|--namespace <NAMESPACE_NAME> - Namespace for the generated code.
853 The default value is MyApp.Namespace.
854
855 .NET Core 2.0
856 console, angular, react, reactredux
857
858 --no-restore - Doesn’t execute an implicit restore during project cre‐
859 ation.
860
861 classlib
862
863 -f|--framework <FRAMEWORK> - Specifies the framework to target. Val‐
864 ues: netcoreapp2.0 to create a .NET Core Class Library or netstan‐
865 dard2.0 to create a .NET Standard Class Library. The default value is
866 netstandard2.0.
867
868 --no-restore - Doesn’t execute an implicit restore during project cre‐
869 ation.
870
871 mstest, xunit
872
873 -p|--enable-pack - Enables packaging for the project using dotnet pack.
874
875 --no-restore - Doesn’t execute an implicit restore during project cre‐
876 ation.
877
878 globaljson
879
880 --sdk-version <VERSION_NUMBER> - Specifies the version of the .NET Core
881 SDK to use in the global.json file.
882
883 web
884
885 --use-launch-settings - Includes launchSettings.json in the generated
886 template output.
887
888 --no-restore - Doesn’t execute an implicit restore during project cre‐
889 ation.
890
891 webapi
892
893 -au|--auth <AUTHENTICATION_TYPE> - The type of authentication to use.
894 The possible values are:
895
896 · None - No authentication (Default).
897
898 · IndividualB2C - Individual authentication with Azure AD B2C.
899
900 · SingleOrg - Organizational authentication for a single tenant.
901
902 · Windows - Windows authentication.
903
904 --aad-b2c-instance <INSTANCE> - The Azure Active Directory B2C instance
905 to connect to. Use with IndividualB2C authentication. The default
906 value is https://login.microsoftonline.com/tfp/.
907
908 -ssp|--susi-policy-id <ID> - The sign-in and sign-up policy ID for this
909 project. Use with IndividualB2C authentication.
910
911 --aad-instance <INSTANCE> - The Azure Active Directory instance to con‐
912 nect to. Use with SingleOrg authentication. The default value is
913 https://login.microsoftonline.com/.
914
915 --client-id <ID> - The Client ID for this project. Use with Individu‐
916 alB2C or SingleOrg authentication. The default value is
917 11111111-1111-1111-11111111111111111.
918
919 --domain <DOMAIN> - The domain for the directory tenant. Use with Sin‐
920 gleOrg or IndividualB2C authentication. The default value is quali‐
921 fied.domain.name.
922
923 --tenant-id <ID> - The TenantId ID of the directory to connect to. Use
924 with SingleOrg authentication. The default value is
925 22222222-2222-2222-2222-222222222222.
926
927 -r|--org-read-access - Allows this application read-access to the di‐
928 rectory. Only applies to SingleOrg or MultiOrg authentication.
929
930 --use-launch-settings - Includes launchSettings.json in the generated
931 template output.
932
933 -uld|--use-local-db - Specifies LocalDB should be used instead of
934 SQLite. Only applies to Individual or IndividualB2C authentication.
935
936 --no-restore - Doesn’t execute an implicit restore during project cre‐
937 ation.
938
939 mvc, razor
940
941 -au|--auth <AUTHENTICATION_TYPE> - The type of authentication to use.
942 The possible values are:
943
944 · None - No authentication (Default).
945
946 · Individual - Individual authentication.
947
948 · IndividualB2C - Individual authentication with Azure AD B2C.
949
950 · SingleOrg - Organizational authentication for a single tenant.
951
952 · MultiOrg - Organizational authentication for multiple tenants.
953
954 · Windows - Windows authentication.
955
956 --aad-b2c-instance <INSTANCE> - The Azure Active Directory B2C instance
957 to connect to. Use with IndividualB2C authentication. The default
958 value is https://login.microsoftonline.com/tfp/.
959
960 -ssp|--susi-policy-id <ID> - The sign-in and sign-up policy ID for this
961 project. Use with IndividualB2C authentication.
962
963 -rp|--reset-password-policy-id <ID> - The reset password policy ID for
964 this project. Use with IndividualB2C authentication.
965
966 -ep|--edit-profile-policy-id <ID> - The edit profile policy ID for this
967 project. Use with IndividualB2C authentication.
968
969 --aad-instance <INSTANCE> - The Azure Active Directory instance to con‐
970 nect to. Use with SingleOrg or MultiOrg authentication. The default
971 value is https://login.microsoftonline.com/.
972
973 --client-id <ID> - The Client ID for this project. Use with Individu‐
974 alB2C, SingleOrg, or MultiOrg authentication. The default value is
975 11111111-1111-1111-11111111111111111.
976
977 --domain <DOMAIN> - The domain for the directory tenant. Use with Sin‐
978 gleOrg or IndividualB2C authentication. The default value is quali‐
979 fied.domain.name.
980
981 --tenant-id <ID> - The TenantId ID of the directory to connect to. Use
982 with SingleOrg authentication. The default value is
983 22222222-2222-2222-2222-222222222222.
984
985 --callback-path <PATH> - The request path within the application’s base
986 path of the redirect URI. Use with SingleOrg or IndividualB2C authen‐
987 tication. The default value is /signin-oidc.
988
989 -r|--org-read-access - Allows this application read-access to the di‐
990 rectory. Only applies to SingleOrg or MultiOrg authentication.
991
992 --use-launch-settings - Includes launchSettings.json in the generated
993 template output.
994
995 --use-browserlink - Includes BrowserLink in the project.
996
997 -uld|--use-local-db - Specifies LocalDB should be used instead of
998 SQLite. Only applies to Individual or IndividualB2C authentication.
999
1000 --no-restore - Doesn’t execute an implicit restore during project cre‐
1001 ation.
1002
1003 page
1004
1005 -na|--namespace <NAMESPACE_NAME>- Namespace for the generated code.
1006 The default value is MyApp.Namespace.
1007
1008 -np|--no-pagemodel - Creates the page without a PageModel.
1009
1010 viewimports
1011
1012 -na|--namespace <NAMESPACE_NAME>- Namespace for the generated code.
1013 The default value is MyApp.Namespace.
1014
1015 .NET Core 1.x
1016 console, xunit, mstest, web, webapi
1017
1018 -f|--framework <FRAMEWORK> - Specifies the framework to target. Val‐
1019 ues: netcoreapp1.0 or netcoreapp1.1. The default value is netcore‐
1020 app1.0.
1021
1022 classlib
1023
1024 -f|--framework <FRAMEWORK> - Specifies the framework to target. Val‐
1025 ues: netcoreapp1.0, netcoreapp1.1, or netstandard1.0 to netstandard1.6.
1026 The default value is netstandard1.4.
1027
1028 mvc
1029
1030 -f|--framework <FRAMEWORK> - Specifies the framework to target. Val‐
1031 ues: netcoreapp1.0 or netcoreapp1.1. The default value is netcore‐
1032 app1.0.
1033
1034 -au|--auth <AUTHENTICATION_TYPE> - The type of authentication to use.
1035 Values: None or Individual. The default value is None.
1036
1037 -uld|--use-local-db - Specifies whether or not to use LocalDB instead
1038 of SQLite. Values: true or false. The default value is false.
1039
1040 * * * * *
1041
1043 Create a C# console application project by specifying the template
1044 name:
1045
1046 dotnet new "Console Application"
1047
1048 Create an F# console application project in the current directory:
1049
1050 dotnet new console -lang F#
1051
1052 Create a .NET Standard class library project in the specified directory
1053 (available only with .NET Core SDK 2.0 or later versions):
1054
1055 dotnet new classlib -lang VB -o MyLibrary
1056
1057 Create a new ASP.NET Core C# MVC project in the current directory with
1058 no authentication:
1059
1060 dotnet new mvc -au None
1061
1062 Create a new xUnit project:
1063
1064 dotnet new xunit
1065
1066 List all templates available for MVC:
1067
1068 dotnet new mvc -l
1069
1070 List all templates matching the we substring. No exact match is found,
1071 so substring matching runs against both the short name and name col‐
1072 umns.
1073
1074 dotnet new we -l
1075
1076 Attempt to invoke the template matching ng. If a single match can’t be
1077 determined, list the templates that are partial matches.
1078
1079 dotnet new ng
1080
1081 Install version 2.0 of the Single Page Application templates for
1082 ASP.NET Core (command option available for .NET Core SDK 1.1 and later
1083 versions only):
1084
1085 dotnet new -i Microsoft.DotNet.Web.Spa.ProjectTemplates::2.0.0
1086
1087 Create a global.json in the current directory setting the SDK version
1088 to 2.0.0 (available only with .NET Core SDK 2.0 or later versions):
1089
1090 dotnet new globaljson --sdk-version 2.0.0
1091
1092 See also
1093 · Custom templates for dotnet new
1094
1095 · Create a custom template for dotnet new
1096
1097 · dotnet/dotnet-template-samples GitHub repo
1098
1099 · Available templates for dotnet new
1100
1101
1102
1103 dotnet new command(1)