-
Notifications
You must be signed in to change notification settings - Fork 6k
dotnet new article - updates for 5.0.3xx SDK #23875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
feb5b0d
7d255f5
2684df2
5380f2b
622656d
d27ff4f
4d7aee8
5aa54ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- | ||
title: dotnet new --install option | ||
description: The dotnet new --install option installs a template package. | ||
ms.date: 04/29/2021 | ||
--- | ||
# dotnet new --install option | ||
|
||
**This article applies to:** ✔️ .NET Core 2.0 SDK and later versions | ||
|
||
## Name | ||
|
||
`dotnet new --install` - installs a template package. | ||
|
||
## Synopsis | ||
|
||
```dotnetcli | ||
dotnet new --install <PATH|NUGET_ID> [--interactive] [--nuget-source <SOURCE>] | ||
``` | ||
|
||
## Description | ||
|
||
The `dotnet new --install` command installs a template package from the `PATH` or `NUGET_ID` provided. If you want to install a prerelease version of a template package, specify the version in the format `<package-name>::<package-version>`. By default, `dotnet new` passes \* for the version, which represents the latest stable package version. For more information, see the [Examples](#examples) section. | ||
|
||
If a version of the template was already installed when you run this command, the template will be updated to the specified version, or to the latest stable version if no version was specified. | ||
For information on creating custom templates, see [Custom templates for dotnet new](custom-templates.md). | ||
|
||
## Options | ||
|
||
- **`--interactive`** | ||
|
||
Allows the command to stop and wait for user input or action (for example to complete authentication). Available since .NET Core 5.0 SDK. | ||
|
||
- **`--nuget-source <SOURCE>`** | ||
|
||
By default, `dotnet new --install` uses the hierarchy of NuGet configuration files from the current directory to determine the NuGet source the package can be installed from. If `--nuget-source` is specified, the source will be added to the list of sources to be checked. | ||
To check the configured sources for the current directory use [`dotnet nuget list source`](dotnet-nuget-list-source.md). For more information, see [Common NuGet Configurations](/nuget/consume-packages/configuring-nuget-behavior) | ||
|
||
## Examples | ||
|
||
- Install the latest version of SPA templates for ASP.NET Core: | ||
|
||
```dotnetcli | ||
dotnet new --install Microsoft.DotNet.Web.Spa.ProjectTemplates | ||
``` | ||
|
||
- Install version 2.0 of the SPA templates for ASP.NET Core: | ||
|
||
```dotnetcli | ||
dotnet new --install Microsoft.DotNet.Web.Spa.ProjectTemplates::2.0.0 | ||
``` | ||
|
||
- Install version 2.0 of the SPA templates for ASP.NET Core from a custom NuGet source using interactive mode: | ||
|
||
```dotnetcli | ||
dotnet new --install Microsoft.DotNet.Web.Spa.ProjectTemplates::2.0.0 --nuget-source "https://api.my-custom-nuget.com/v3/index.json" --interactive | ||
``` | ||
|
||
## See also | ||
|
||
- [dotnet new command](dotnet-new.md) | ||
- [dotnet new --search option](dotnet-new-search.md) | ||
- [Custom templates for dotnet new](custom-templates.md) |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,109 @@ | ||||||
--- | ||||||
title: dotnet new --list option | ||||||
description: The dotnet new --list option lists available templates. | ||||||
ms.date: 04/29/2021 | ||||||
--- | ||||||
# dotnet new --list option | ||||||
|
||||||
**This article applies to:** ✔️ .NET Core 2.0 SDK and later versions | ||||||
|
||||||
## Name | ||||||
|
||||||
`dotnet new --list` - Lists available templates to be run using `dotnet new`. | ||||||
|
||||||
## Synopsis | ||||||
|
||||||
```dotnetcli | ||||||
dotnet new [<TEMPLATE_NAME>] -l|--list [--author <AUTHOR>] [-lang|--language {"C#"|"F#"|VB}] | ||||||
[--tag <TAG>] [--type <TYPE>] [--columns <COLUMNS>] [--columns-all] | ||||||
``` | ||||||
|
||||||
## Description | ||||||
|
||||||
The `dotnet new --list` option lists available templates to use with `dotnet new`. If the <TEMPLATE_NAME> is specified, lists templates containing the specified name. This option lists only default and installed templates. To find templates in NuGet that you can install locally, use the [`--search`](dotnet-new-search.md) option. | ||||||
|
||||||
## Arguments | ||||||
|
||||||
- **`TEMPLATE_NAME`** | ||||||
|
||||||
If the argument is specified, only the templates containing `<TEMPLATE_NAME>` in template name or short name will be shown. | ||||||
|
||||||
## Options | ||||||
|
||||||
- **`--author <AUTHOR>`** | ||||||
|
||||||
Filters templates based on template author. Partial match is supported. Available since .NET Core 5.0.300 SDK. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Depends on outcome in #23875 (comment) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're correct, ignore this suggestion and the others like it in this article. |
||||||
|
||||||
- **`--columns <COLUMNS>`** | ||||||
|
||||||
Comma-separated list of columns to display in the output. The supported columns are: | ||||||
- `language` - A comma-separated list of languages supported by the template. | ||||||
- `tags` - The list of template tags. | ||||||
- `author` - The template author. | ||||||
- `type` - The template type: project or item. | ||||||
|
||||||
The template name and short name are always shown. The default list of columns is template name, short name, language, and tags. This list is equivalent to specifying `--columns=language,tags`. | ||||||
Available since .NET Core 5.0.300 SDK. | ||||||
|
||||||
- **`--columns-all`** | ||||||
|
||||||
Displays all columns in the output. Available since .NET Core 5.0.300 SDK. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Depends on outcome in #23875 (comment) |
||||||
|
||||||
- **`-lang|--language {C#|F#|VB}`** | ||||||
|
||||||
Filters templates based on language supported by the template. The language accepted varies by the template. Not valid for some templates. | ||||||
|
||||||
> [!NOTE] | ||||||
> Some shells interpret `#` as a special character. In those cases, enclose the language parameter value in quotes. For example, `dotnet new --list --language "F#"`. | ||||||
|
||||||
- **`--tag <TAG>`** | ||||||
|
||||||
Filters templates based on template tags. To be selected, a template must have at least one tag that exactly matches the criteria. Available since .NET Core 5.0.300 SDK. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Depends on outcome in #23875 (comment) |
||||||
|
||||||
- **`--type <TYPE>`** | ||||||
|
||||||
Filters templates based on template type. Predefined values are `project` and `item`. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Should we take this opportunity to include "solution"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like we should also explain the difference between types when adding "solution" in https://docs.microsoft.com/en-us/dotnet/core/tools/custom-templates. |
||||||
|
||||||
## Examples | ||||||
|
||||||
- List all templates | ||||||
|
||||||
```dotnetcli | ||||||
dotnet new --list | ||||||
``` | ||||||
|
||||||
- List all Single Page Application (SPA) templates: | ||||||
|
||||||
```dotnetcli | ||||||
dotnet new spa --list | ||||||
``` | ||||||
|
||||||
- List all templates matching the *we* substring. | ||||||
|
||||||
```dotnetcli | ||||||
dotnet new we --list | ||||||
``` | ||||||
|
||||||
- List all templates matching the *we* substring that support the F# language. | ||||||
|
||||||
```dotnetcli | ||||||
dotnet new we --list --language "F#" | ||||||
``` | ||||||
|
||||||
- List all item templates. | ||||||
|
||||||
```dotnetcli | ||||||
dotnet new --list --type item | ||||||
``` | ||||||
|
||||||
- List all C# templates, showing the author and the type in the output. | ||||||
|
||||||
```dotnetcli | ||||||
dotnet new --list --language "C#" --columns "author,type" | ||||||
``` | ||||||
|
||||||
## See also | ||||||
|
||||||
- [dotnet new command](dotnet-new.md) | ||||||
- [dotnet new --search option](dotnet-new-search.md) | ||||||
- [Custom templates for dotnet new](custom-templates.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--list option exists from .NET Core 2.0 SDK. Only few options were added in 5.0.3xx (--author, --tag, --columns, --columns-all).