Skip to content

Commit 0cd6ba7

Browse files
authored
Update tool and template tutorials for .NET 5 (#21956)
1 parent 7d72a34 commit 0cd6ba7

File tree

5 files changed

+112
-109
lines changed

5 files changed

+112
-109
lines changed

docs/core/tools/global-tools-how-to-create.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ This tutorial teaches you how to create and package a .NET tool. The .NET CLI le
1313

1414
The tool that you'll create is a console application that takes a message as input and displays the message along with lines of text that create the image of a robot.
1515

16-
This is the first in a series of three tutorials. In this tutorial, you create and package a tool. In the next two tutorials you [use the tool as a global tool](global-tools-how-to-use.md) and [use the tool as a local tool](local-tools-how-to-use.md).
16+
This is the first in a series of three tutorials. In this tutorial, you create and package a tool. In the next two tutorials you [use the tool as a global tool](global-tools-how-to-use.md) and [use the tool as a local tool](local-tools-how-to-use.md). The procedures for creating a tool are the same whether you use it as a global tool or as a local tool.
1717

1818
## Prerequisites
1919

20-
- [.NET Core SDK 3.1](https://dotnet.microsoft.com/download) or a later version.
20+
- [.NET SDK 5.0](https://dotnet.microsoft.com/download) or a later version.
2121

22-
This tutorial and the following [tutorial for global tools](global-tools-how-to-use.md) apply to .NET Core SDK 2.1 and later versions because global tools are available starting in that version. But this tutorial assumes you have installed 3.1 or later so that you have the option of continuing on to the [local tools tutorial](local-tools-how-to-use.md). Local tools are available starting in .NET Core SDK 3.0. The procedures for creating a tool are the same whether you use it as a global tool or as a local tool.
22+
This tutorial uses .NET SDK 5.0, but global tools are available starting in .NET Core SDK 2.1. Local tools are available starting in .NET Core SDK 3.0.
2323

2424
- A text editor or code editor of your choice.
2525

@@ -153,7 +153,7 @@ Before you can pack and distribute the application as a tool, you need to modify
153153

154154
`<ToolCommandName>` is an optional element that specifies the command that will invoke the tool after it's installed. If this element isn't provided, the command name for the tool is the project file name without the *.csproj* extension.
155155

156-
`<PackageOutputPath>` is an optional element that determines where the NuGet package will be produced. The NuGet package is what the .NET Core CLI uses to install your tool.
156+
`<PackageOutputPath>` is an optional element that determines where the NuGet package will be produced. The NuGet package is what the .NET CLI uses to install your tool.
157157

158158
The project file now looks like the following example:
159159

@@ -163,7 +163,7 @@ Before you can pack and distribute the application as a tool, you need to modify
163163
<PropertyGroup>
164164

165165
<OutputType>Exe</OutputType>
166-
<TargetFramework>netcoreapp3.1</TargetFramework>
166+
<TargetFramework>net5.0</TargetFramework>
167167

168168
<PackAsTool>true</PackAsTool>
169169
<ToolCommandName>botsay</ToolCommandName>

docs/core/tools/local-tools-how-to-use.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Tutorial: Install and use .NET local tools"
33
description: Learn how to install and use a .NET tool as a local tool.
44
ms.topic: tutorial
5-
ms.date: 02/12/2020
5+
ms.date: 12/11/2020
66
---
77

88
# Tutorial: Install and use a .NET local tool using the .NET CLI
@@ -167,7 +167,7 @@ You typically install a local tool in the root directory of the repository. Afte
167167

168168
## Update a local tool
169169

170-
The installed version of local tool `dotnetsay` is 2.1.3. The latest version is 2.1.4. Use the [dotnet tool update](dotnet-tool-update.md) command to update the tool to the latest version.
170+
The installed version of local tool `dotnetsay` is 2.1.3. Use the [dotnet tool update](dotnet-tool-update.md) command to update the tool to the latest version.
171171

172172
```dotnetcli
173173
dotnet tool update dotnetsay
@@ -176,7 +176,7 @@ dotnet tool update dotnetsay
176176
The output indicates the new version number:
177177

178178
```console
179-
Tool 'dotnetsay' was successfully updated from version '2.1.3' to version '2.1.4'
179+
Tool 'dotnetsay' was successfully updated from version '2.1.3' to version '2.1.7'
180180
(manifest file /home/name/repository/.config/dotnet-tools.json).
181181
```
182182

@@ -200,4 +200,4 @@ If you get an error message while following the tutorial, see [Troubleshoot .NET
200200

201201
## See also
202202

203-
For more information, see [.NET Core tools](global-tools.md)
203+
For more information, see [.NET tools](global-tools.md)

docs/core/tutorials/cli-templates-create-item-template.md

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
2-
title: Create an item template for dotnet new - .NET Core CLI
2+
title: Create an item template for dotnet new - .NET CLI
33
description: Learn how to create an item template for the dotnet new command. Item templates can contain any number of files.
44
author: adegeo
5-
ms.date: 06/25/2019
5+
ms.date: 12/11/2020
66
ms.topic: tutorial
77
ms.author: adegeo
88
---
99

1010
# Tutorial: Create an item template
1111

12-
With .NET Core, you can create and deploy templates that generate projects, files, even resources. This tutorial is part one of a series that teaches you how to create, install, and uninstall, templates for use with the `dotnet new` command.
12+
With .NET, you can create and deploy templates that generate projects, files, even resources. This tutorial is part one of a series that teaches you how to create, install, and uninstall templates for use with the `dotnet new` command.
1313

1414
In this part of the series, you'll learn how to:
1515

@@ -23,7 +23,7 @@ In this part of the series, you'll learn how to:
2323
2424
## Prerequisites
2525

26-
* [.NET Core 2.2 SDK](https://dotnet.microsoft.com/download) or later versions.
26+
* [.NET 5.0 SDK](https://dotnet.microsoft.com/download) or a later version.
2727
* Read the reference article [Custom templates for dotnet new](../tools/custom-templates.md).
2828

2929
The reference article explains the basics about templates and how they're put together. Some of this information will be reiterated here.
@@ -80,7 +80,7 @@ Now that you have the content of the template created, you need to create the te
8080

8181
## Create the template config
8282

83-
Templates are recognized in .NET Core by a special folder and config file that exist at the root of your template. In this tutorial, your template folder is located at _working\templates\extensions_.
83+
Templates are recognized by a special folder and config file that exist at the root of your template. In this tutorial, your template folder is located at _working\templates\extensions_.
8484

8585
When you create a template, all files and folders in the template folder are included as part of the template except for the special config folder. This config folder is named _.template.config_.
8686

@@ -111,7 +111,7 @@ Open the _template.json_ with your favorite text editor and paste in the followi
111111
}
112112
```
113113

114-
This config file contains all the settings for your template. You can see the basic settings, such as `name` and `shortName`, but there's also a `tags/type` value that is set to `item`. This categorizes your template as an item template. There's no restriction on the type of template you create. The `item` and `project` values are common names that .NET Core recommends so that users can easily filter the type of template they're searching for.
114+
This config file contains all the settings for your template. You can see the basic settings, such as `name` and `shortName`, but there's also a `tags/type` value that is set to `item`. This categorizes your template as an item template. There's no restriction on the type of template you create. The `item` and `project` values are common names that .NET recommends so that users can easily filter the type of template they're searching for.
115115

116116
The `classifications` item represents the **tags** column you see when you run `dotnet new` and get a list of templates. Users can also search based on classification tags. Don't confuse the `tags` property in the \*.json file with the `classifications` tags list. They're two different things unfortunately named similarly. The full schema for the *template.json* file is found at the [JSON Schema Store](http://json.schemastore.org/template). For more information about the *template.json* file, see the [dotnet templating wiki](https://github.com/dotnet/templating/wiki).
117117

@@ -132,14 +132,12 @@ Options:
132132

133133
... cut to save space ...
134134

135-
Templates Short Name Language Tags
136-
-------------------------------------------------------------------------------------------------------------------------------
137-
Example templates: string extensions stringext [C#] Common/Code
138-
Console Application console [C#], F#, VB Common/Console
139-
Class library classlib [C#], F#, VB Common/Library
140-
WPF Application wpf [C#], VB Common/WPF
141-
Windows Forms (WinForms) Application winforms [C#], VB Common/WinForms
142-
Worker Service worker [C#] Common/Worker/Web
135+
Templates Short Name Language Tags
136+
-------------------------------------------- ------------------- ------------ ----------------------
137+
Example templates: string extensions stringext [C#] Common/Code
138+
Console Application console [C#], F#, VB Common/Console
139+
Class library classlib [C#], F#, VB Common/Library
140+
WPF Application wpf [C#], VB Common/WPF
143141
```
144142

145143
## Test the item template
@@ -204,11 +202,11 @@ You get the following output.
204202
!dlroW olleH
205203
```
206204

207-
Congratulations! You created and deployed an item template with .NET Core. In preparation for the next part of this tutorial series, you must uninstall the template you created. Make sure to delete all files from the _test_ folder too. This will get you back to a clean state ready for the next major section of this tutorial.
205+
Congratulations! You created and deployed an item template with .NET. In preparation for the next part of this tutorial series, you must uninstall the template you created. Make sure to delete all files from the _test_ folder too. This will get you back to a clean state ready for the next major section of this tutorial.
208206

209207
## Uninstall the template
210208

211-
Because you installed the template by file path, you must uninstall it with the **absolute** file path. You can see a list of templates installed by running the `dotnet new -u` command. Your template should be listed last. Use the path listed to uninstall your template with the `dotnet new -u <ABSOLUTE PATH TO TEMPLATE DIRECTORY>` command.
209+
Because you installed the template by file path, you must uninstall it with the **absolute** file path. You can see a list of templates installed by running the `dotnet new -u` command. Your template should be listed last. Use the `Uninstall Command` listed to uninstall your template.
212210

213211
```dotnetcli
214212
dotnet new -u
@@ -220,31 +218,31 @@ You get output similar to the following.
220218
Template Instantiation Commands for .NET Core CLI
221219

222220
Currently installed items:
223-
Microsoft.DotNet.Common.ItemTemplates
221+
Microsoft.DotNet.Common.ProjectTemplates.2.2
222+
Details:
223+
NuGetPackageId: Microsoft.DotNet.Common.ProjectTemplates.2.2
224+
Version: 1.0.2-beta4
225+
Author: Microsoft
224226
Templates:
225-
dotnet gitignore file (gitignore)
226-
global.json file (globaljson)
227-
NuGet Config (nugetconfig)
228-
Solution File (sln)
229-
Dotnet local tool manifest file (tool-manifest)
230-
Web Config (webconfig)
227+
Class library (classlib) C#
228+
Class library (classlib) F#
229+
Class library (classlib) VB
230+
Console Application (console) C#
231+
Console Application (console) F#
232+
Console Application (console) VB
233+
Uninstall Command:
234+
dotnet new -u Microsoft.DotNet.Common.ProjectTemplates.2.2
231235

232236
... cut to save space ...
233237

234-
NUnit3.DotNetNew.Template
235-
Templates:
236-
NUnit 3 Test Project (nunit) C#
237-
NUnit 3 Test Item (nunit-test) C#
238-
NUnit 3 Test Project (nunit) F#
239-
NUnit 3 Test Item (nunit-test) F#
240-
NUnit 3 Test Project (nunit) VB
241-
NUnit 3 Test Item (nunit-test) VB
242-
C:\working\templates\extensions
238+
C:\Test\templatetutorial\working\templates\extensions
243239
Templates:
244240
Example templates: string extensions (stringext) C#
241+
Uninstall Command:
242+
dotnet new -u C:\working\templates\extensions
245243
```
246244

247-
To uninstall a template, run the following command.
245+
To uninstall the template that you created, run the `Uninstall Command` that is shown in the output.
248246

249247
```dotnetcli
250248
dotnet new -u C:\working\templates\extensions

0 commit comments

Comments
 (0)