From 11d4eb19c0d1d5a225f47b6c06d1adf1d86b4ead Mon Sep 17 00:00:00 2001 From: YuliiaKovalova <95473390+YuliiaKovalova@users.noreply.github.com> Date: Wed, 28 Jun 2023 11:57:31 +0200 Subject: [PATCH 01/12] Update cli-templates-create-template-package.md --- .../cli-templates-create-template-package.md | 90 +++++++++---------- 1 file changed, 43 insertions(+), 47 deletions(-) diff --git a/docs/core/tutorials/cli-templates-create-template-package.md b/docs/core/tutorials/cli-templates-create-template-package.md index fe29529c6753c..33cc11f42d6a7 100644 --- a/docs/core/tutorials/cli-templates-create-template-package.md +++ b/docs/core/tutorials/cli-templates-create-template-package.md @@ -17,8 +17,7 @@ In this part of the series you'll learn how to: > [!div class="checklist"] > -> * Create a \*.csproj project to build a template package -> * Configure the project file for packing +> * Create template package using [Microsoft.TemplateEngine.Authoring.Templates](https://www.nuget.org/packages/Microsoft.TemplateEngine.Authoring.Templates) > * Install a template package from a NuGet package file > * Uninstall a template package by package ID @@ -28,96 +27,94 @@ In this part of the series you'll learn how to: This tutorial uses the two templates created in the first two parts of this tutorial. You can use a different template as long as you copy the template, as a folder, into the _working\templates\\_ folder. -* Open a terminal and navigate to the _working\\_ folder. +* Open a terminal. [!INCLUDE [dotnet6-syntax-note](includes/dotnet6-syntax-note.md)] ## Create a template package project -A template package is one or more templates packaged into a NuGet package. When you install or uninstall a template package, all templates contained in the package are added or removed, respectively. The previous parts of this tutorial series only worked with individual templates. To share a non-packed template, you have to copy the template folder and install via that folder. Because a template package can have more than one template in it, and is a single file, sharing is easier. +A template package is one or more templates packed into a NuGet package. When you install or uninstall a template package, all templates contained in the package are added or removed, respectively. Template packages are represented by a NuGet package (_.nupkg_) file. And, like any NuGet package, you can upload the template package to a NuGet feed. The `dotnet new install` command supports installing template package from a NuGet package feed. Additionally, you can install a template package from a _.nupkg_ file directly. Normally you use a C# project file to compile code and produce a binary. However, the project can also be used to generate a template package. By changing the settings of the _.csproj_, you can prevent it from compiling any code and instead include all the assets of your templates as resources. When this project is built, it produces a template package NuGet package. -The package you'll create will include the [item template](cli-templates-create-item-template.md) and [package template](cli-templates-create-project-template.md) previously created. Because we grouped the two templates into the _working\templates\\_ folder, we can use the _working_ folder for the _.csproj_ file. - -In your terminal, navigate to the _working_ folder. Create a new project and set the name to `templatepack` and the output folder to the current folder. +The package you are going to generate will include the [item template](cli-templates-create-item-template.md) and [package template](cli-templates-create-project-template.md) previously created. +In your terminal, run the command: ```dotnetcli -dotnet new console -n templatepack -o . +dotnet new install Microsoft.TemplateEngine.Authoring.Templates ``` +This [template package](https://github.com/dotnet/templating/tree/main/template_feed/Microsoft.TemplateEngine.Authoring.Templates) contains templates useful for the template authoring. -The `-n` parameter sets the _.csproj_ filename to _templatepack.csproj_. The `-o` parameter creates the files in the current directory. You should see a result similar to the following output. +Navigate to the _working_ folder and run: +```dotnetcli +dotnet new templatepack --name "templatepack" +``` +The `--name` parameter sets the _.csproj_ filename to _templatepack.csproj_. You should see a result similar to the following output. ```console -The template "Console Application" was created successfully. +The template "Template Package" was created successfully. Processing post-creation actions... -Running 'dotnet restore' on .\templatepack.csproj... - Restore completed in 52.38 ms for C:\working\templatepack.csproj. - -Restore succeeded. +Description: Manual actions required +Manual instructions: Open *.csproj in the editor and complete the package metadata configuration. Copy the templates to 'content' folder. Fill in README.md. ``` - -The new project template generates a _Program.cs_ file. You can safely delete this file as it's not used by the templates. - -Next, open the _templatepack.csproj_ file in your favorite editor and replace the content with the following XML: - +Next, open the _templatepack.csproj_ file in a code editor and populate it according to the hints in the template: ```xml - Template - 1.0 + + AdatumCorporation.Utility.Templates + 1.0 AdatumCorporation Templates Me Templates to use when creating an application for Adatum Corporation. dotnet-new;templates;contoso + https://github.com/dotnet/samples/tree/main/core/tutorials/cli-templates-create-item-template - netstandard2.0 - + + Template + net8.0 true false content $(NoWarn);NU5128 true + README.md + + + + false - + + + + + + + + + ``` - -The settings under `` in the XML snippet are broken into three groups. - -The first group deals with properties required for a NuGet package. The three `` settings have to do with the NuGet package properties to identify your package on a NuGet feed. Specifically the `` value is used to uninstall the template package with a single name instead of a directory path. It can also be used to install the template package from a NuGet feed. The remaining settings, such as `` and `<PackageTags>`, have to do with metadata displayed on the NuGet feed. For more information about NuGet settings, see [NuGet and MSBuild properties](/nuget/reference/msbuild-targets). - -> [!NOTE] -> To ensure that the template package appears in `dotnet new search` results, set `<PackageType>` to `Template`. - -In the second group, the `<TargetFramework>` setting ensures that MSBuild executes properly when you run the pack command to compile and pack the project. - -The third group includes settings that have to do with configuring the project to include the templates in the appropriate folder in the NuGet pack when it's created: - -* The `<NoWarn>` setting suppresses a warning message that doesn't apply to template package projects. - -* The `<NoDefaultExcludes>` setting ensures that files and folders that start with a `.` (like `.gitignore`) are part of the template. The *default* behavior of NuGet packages is to ignore those files and folders. - -`<ItemGroup>` contains two items. First, the `<Content>` item includes everything in the _templates_ folder as content. It's also set to exclude any _bin_ folder or _obj_ folder to prevent any compiled code (if you tested and compiled your templates) from being included. Second, the `<Compile>` item excludes all code files from compiling no matter where they're located. This setting prevents the project that's used to create the template package from trying to compile the code in the _templates_ folder hierarchy. +For getting more information about content of _templatepack.csproj_ file, navigate to [Create a NuGet package using MSBuild](https://learn.microsoft.com/en-us/nuget/create-packages/creating-a-package-msbuild). ## Build and install -Save the project file. Before building the template package, verify that your folder structure is correct. Any template you want to pack should be placed in the _templates_ folder, in its own folder. The folder structure should look similar to the following hierarchy: +Save changes in _templatepack.csproj_ file. Before building the template package, verify that your folder structure is correct. Any custom template should be placed in the _content_ folder, in its own folder. The hierarchy should look similar to: ```console working │ templatepack.csproj -└───templates +└───content ├───extensions │ └───.template.config │ template.json @@ -126,7 +123,7 @@ working template.json ``` -The _templates_ folder has two folders: _extensions_ and _consoleasync_. +The _content_ folder has two folders: _extensions_ and _consoleasync_. By default, _content_ also contains _SampleTemplate_, that can safely deleted as it was added to authoring template for demonstration purposes. In your terminal, from the _working_ folder, run the `dotnet pack` command. This command builds your project and creates a NuGet package in the _working\bin\Debug_ folder, as indicated by the following output: @@ -138,7 +135,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. Restore completed in 123.86 ms for C:\working\templatepack.csproj. - templatepack -> C:\working\bin\Debug\netstandard2.0\templatepack.dll + templatepack -> C:\working\bin\Debug\net8.0\templatepack.dll Successfully created package 'C:\working\bin\Debug\AdatumCorporation.Utility.Templates.1.0.0.nupkg'. ``` @@ -155,7 +152,6 @@ Templates Short Name Langu Example templates: string extensions stringext [C#] Common/Code Example templates: async project consoleasync [C#] Common/Console/C#9 ``` - If you uploaded the NuGet package to a NuGet feed, you can use the `dotnet new install <PACKAGE_ID>` command where `<PACKAGE_ID>` is the same as the `<PackageId>` setting from the _.csproj_ file. This package ID is the same as the NuGet package identifier. ## Uninstall the template package @@ -186,7 +182,7 @@ Congratulations! You've installed and uninstalled a template package. ## Next steps To learn more about templates, most of which you've already learned, see the [Custom templates for dotnet new](../tools/custom-templates.md) article. - +* [Template Authoring Tools](https://github.com/dotnet/templating/tree/main/tools) * [dotnet/templating GitHub repo Wiki](https://github.com/dotnet/templating/wiki) * [dotnet/dotnet-template-samples GitHub repo](https://github.com/dotnet/dotnet-template-samples) * [*template.json* schema at the JSON Schema Store](http://json.schemastore.org/template) From 4f482e70cfb58018150f73c60682703cdb6ae7ad Mon Sep 17 00:00:00 2001 From: YuliiaKovalova <95473390+YuliiaKovalova@users.noreply.github.com> Date: Wed, 28 Jun 2023 12:05:37 +0200 Subject: [PATCH 02/12] fix linter errors --- .../tutorials/cli-templates-create-template-package.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/core/tutorials/cli-templates-create-template-package.md b/docs/core/tutorials/cli-templates-create-template-package.md index 33cc11f42d6a7..0bcc02c32ff7e 100644 --- a/docs/core/tutorials/cli-templates-create-template-package.md +++ b/docs/core/tutorials/cli-templates-create-template-package.md @@ -35,22 +35,26 @@ In this part of the series you'll learn how to: A template package is one or more templates packed into a NuGet package. When you install or uninstall a template package, all templates contained in the package are added or removed, respectively. -Template packages are represented by a NuGet package (_.nupkg_) file. And, like any NuGet package, you can upload the template package to a NuGet feed. The `dotnet new install` command supports installing template package from a NuGet package feed. Additionally, you can install a template package from a _.nupkg_ file directly. +Template packages are represented by a NuGet package (_.nupkg_) file. And, like any NuGet package, you can upload the template package to a NuGet feed. The `dotnet new install` command supports installing template packages from a NuGet package feed. Additionally, you can install a template package from a _.nupkg_ file directly. Normally you use a C# project file to compile code and produce a binary. However, the project can also be used to generate a template package. By changing the settings of the _.csproj_, you can prevent it from compiling any code and instead include all the assets of your templates as resources. When this project is built, it produces a template package NuGet package. The package you are going to generate will include the [item template](cli-templates-create-item-template.md) and [package template](cli-templates-create-project-template.md) previously created. In your terminal, run the command: + ```dotnetcli dotnet new install Microsoft.TemplateEngine.Authoring.Templates ``` + This [template package](https://github.com/dotnet/templating/tree/main/template_feed/Microsoft.TemplateEngine.Authoring.Templates) contains templates useful for the template authoring. Navigate to the _working_ folder and run: + ```dotnetcli dotnet new templatepack --name "templatepack" ``` + The `--name` parameter sets the _.csproj_ filename to _templatepack.csproj_. You should see a result similar to the following output. ```console @@ -60,7 +64,9 @@ Processing post-creation actions... Description: Manual actions required Manual instructions: Open *.csproj in the editor and complete the package metadata configuration. Copy the templates to 'content' folder. Fill in README.md. ``` + Next, open the _templatepack.csproj_ file in a code editor and populate it according to the hints in the template: + ```xml <Project Sdk="Microsoft.NET.Sdk"> @@ -105,6 +111,7 @@ Next, open the _templatepack.csproj_ file in a code editor and populate it accor </Project> ``` + For getting more information about content of _templatepack.csproj_ file, navigate to [Create a NuGet package using MSBuild](https://learn.microsoft.com/en-us/nuget/create-packages/creating-a-package-msbuild). ## Build and install @@ -152,6 +159,7 @@ Templates Short Name Langu Example templates: string extensions stringext [C#] Common/Code Example templates: async project consoleasync [C#] Common/Console/C#9 ``` + If you uploaded the NuGet package to a NuGet feed, you can use the `dotnet new install <PACKAGE_ID>` command where `<PACKAGE_ID>` is the same as the `<PackageId>` setting from the _.csproj_ file. This package ID is the same as the NuGet package identifier. ## Uninstall the template package From a8ec8c78708f9b442c61fa180947f0ac21230b90 Mon Sep 17 00:00:00 2001 From: YuliiaKovalova <95473390+YuliiaKovalova@users.noreply.github.com> Date: Wed, 28 Jun 2023 12:15:29 +0200 Subject: [PATCH 03/12] Update cli-templates-create-template-package.md fix linter errors --- docs/core/tutorials/cli-templates-create-template-package.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/core/tutorials/cli-templates-create-template-package.md b/docs/core/tutorials/cli-templates-create-template-package.md index 0bcc02c32ff7e..8c26b0008942c 100644 --- a/docs/core/tutorials/cli-templates-create-template-package.md +++ b/docs/core/tutorials/cli-templates-create-template-package.md @@ -190,6 +190,7 @@ Congratulations! You've installed and uninstalled a template package. ## Next steps To learn more about templates, most of which you've already learned, see the [Custom templates for dotnet new](../tools/custom-templates.md) article. + * [Template Authoring Tools](https://github.com/dotnet/templating/tree/main/tools) * [dotnet/templating GitHub repo Wiki](https://github.com/dotnet/templating/wiki) * [dotnet/dotnet-template-samples GitHub repo](https://github.com/dotnet/dotnet-template-samples) From 8fb13557de4c9815414fd23c4036f1b9f46c9768 Mon Sep 17 00:00:00 2001 From: YuliiaKovalova <95473390+YuliiaKovalova@users.noreply.github.com> Date: Wed, 28 Jun 2023 15:54:48 +0200 Subject: [PATCH 04/12] Update cli-templates-create-template-package.md --- docs/core/tutorials/cli-templates-create-template-package.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/core/tutorials/cli-templates-create-template-package.md b/docs/core/tutorials/cli-templates-create-template-package.md index 8c26b0008942c..e31c757a6ad27 100644 --- a/docs/core/tutorials/cli-templates-create-template-package.md +++ b/docs/core/tutorials/cli-templates-create-template-package.md @@ -47,7 +47,7 @@ In your terminal, run the command: dotnet new install Microsoft.TemplateEngine.Authoring.Templates ``` -This [template package](https://github.com/dotnet/templating/tree/main/template_feed/Microsoft.TemplateEngine.Authoring.Templates) contains templates useful for the template authoring. +This [template package](https://github.com/dotnet/templating/tree/main/template_feed/Microsoft.TemplateEngine.Authoring.Templates) contains templates useful for template authoring. Navigate to the _working_ folder and run: @@ -112,7 +112,7 @@ Next, open the _templatepack.csproj_ file in a code editor and populate it accor </Project> ``` -For getting more information about content of _templatepack.csproj_ file, navigate to [Create a NuGet package using MSBuild](https://learn.microsoft.com/en-us/nuget/create-packages/creating-a-package-msbuild). +For getting more information about content of _templatepack.csproj_ file, navigate to [Pack a template into a NuGet package (nupkg file)](https://learn.microsoft.com/en-us/dotnet/core/tools/custom-templates#pack-a-template-into-a-nuget-package-nupkg-file). ## Build and install From 0db50b75884703d986124b6f190f08537a17682f Mon Sep 17 00:00:00 2001 From: YuliiaKovalova <95473390+YuliiaKovalova@users.noreply.github.com> Date: Mon, 3 Jul 2023 16:16:41 +0200 Subject: [PATCH 05/12] fix build error --- .../cli-templates-create-template-package.md | 37 ++----------------- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/docs/core/tutorials/cli-templates-create-template-package.md b/docs/core/tutorials/cli-templates-create-template-package.md index e31c757a6ad27..77dc00495924c 100644 --- a/docs/core/tutorials/cli-templates-create-template-package.md +++ b/docs/core/tutorials/cli-templates-create-template-package.md @@ -68,11 +68,9 @@ Manual instructions: Open *.csproj in the editor and complete the package metada Next, open the _templatepack.csproj_ file in a code editor and populate it according to the hints in the template: ```xml -<Project Sdk="Microsoft.NET.Sdk"> - - <PropertyGroup> + <PropertyGroup> <!-- The package metadata. Fill in the properties marked as TODO below --> - <!-- Follow the instructions on https://learn.microsoft.com/en-us/nuget/create-packages/package-authoring-best-practices --> + <!-- Follow the instructions on https://learn.microsoft.com/nuget/create-packages/package-authoring-best-practices --> <PackageId>AdatumCorporation.Utility.Templates</PackageId> <PackageVersion>1.0</PackageVersion> <Title>AdatumCorporation Templates @@ -80,39 +78,10 @@ Next, open the _templatepack.csproj_ file in a code editor and populate it accor Templates to use when creating an application for Adatum Corporation. dotnet-new;templates;contoso https://github.com/dotnet/samples/tree/main/core/tutorials/cli-templates-create-item-template - - - Template - net8.0 - true - false - content - $(NoWarn);NU5128 - true - README.md - - - - false - - - - - - - - - - - - - - - ``` -For getting more information about content of _templatepack.csproj_ file, navigate to [Pack a template into a NuGet package (nupkg file)](https://learn.microsoft.com/en-us/dotnet/core/tools/custom-templates#pack-a-template-into-a-nuget-package-nupkg-file). +For getting more information about content of _templatepack.csproj_ file, navigate to [Pack a template into a NuGet package (nupkg file)](https://learn.microsoft.com/dotnet/core/tools/custom-templates#pack-a-template-into-a-nuget-package-nupkg-file). ## Build and install From e4cdf1198a573a9e09a1afb9374787a215b03416 Mon Sep 17 00:00:00 2001 From: Vlada Shubina Date: Tue, 11 Jul 2023 13:40:35 +0200 Subject: [PATCH 06/12] naming, fixes to links and some additional info --- .../cli-templates-create-template-package.md | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/docs/core/tutorials/cli-templates-create-template-package.md b/docs/core/tutorials/cli-templates-create-template-package.md index 77dc00495924c..5aa57a2113b24 100644 --- a/docs/core/tutorials/cli-templates-create-template-package.md +++ b/docs/core/tutorials/cli-templates-create-template-package.md @@ -35,27 +35,28 @@ In this part of the series you'll learn how to: A template package is one or more templates packed into a NuGet package. When you install or uninstall a template package, all templates contained in the package are added or removed, respectively. -Template packages are represented by a NuGet package (_.nupkg_) file. And, like any NuGet package, you can upload the template package to a NuGet feed. The `dotnet new install` command supports installing template packages from a NuGet package feed. Additionally, you can install a template package from a _.nupkg_ file directly. +Template packages are represented by a NuGet package (_.nupkg_) file. And, like any NuGet package, you can upload the template package to a NuGet feed. The `dotnet new install` [command](../tools/dotnet-new-install.md) supports installing template packages from a NuGet package feed. Additionally, you can install a template package from a _.nupkg_ file directly. Normally you use a C# project file to compile code and produce a binary. However, the project can also be used to generate a template package. By changing the settings of the _.csproj_, you can prevent it from compiling any code and instead include all the assets of your templates as resources. When this project is built, it produces a template package NuGet package. The package you are going to generate will include the [item template](cli-templates-create-item-template.md) and [package template](cli-templates-create-project-template.md) previously created. +In order to create the template package, we will use the template for the template package provided by [Microsoft.TemplateEngine.Authoring.Templates](https://www.nuget.org/packages/Microsoft.TemplateEngine.Authoring.Templates). In your terminal, run the command: ```dotnetcli dotnet new install Microsoft.TemplateEngine.Authoring.Templates ``` -This [template package](https://github.com/dotnet/templating/tree/main/template_feed/Microsoft.TemplateEngine.Authoring.Templates) contains templates useful for template authoring. +This [template package](https://www.nuget.org/packages/Microsoft.TemplateEngine.Authoring.Templates) contains templates useful for template authoring. Note: nuget.org should be available as NuGet feed inside the working directory to install this template package. Navigate to the _working_ folder and run: ```dotnetcli -dotnet new templatepack --name "templatepack" +dotnet new templatepack --name "AdatumCorporation.Utility.Templates" ``` -The `--name` parameter sets the _.csproj_ filename to _templatepack.csproj_. You should see a result similar to the following output. +The `--name` parameter sets the _.csproj_ filename to _AdatumCorporation.Utility.Templates.csproj_. You should see a result similar to the following output. ```console The template "Template Package" was created successfully. @@ -65,7 +66,7 @@ Description: Manual actions required Manual instructions: Open *.csproj in the editor and complete the package metadata configuration. Copy the templates to 'content' folder. Fill in README.md. ``` -Next, open the _templatepack.csproj_ file in a code editor and populate it according to the hints in the template: +Next, open the _AdatumCorporation.Utility.Templates.csproj_ file in a code editor and populate it according to the hints in the template: ```xml @@ -81,15 +82,29 @@ Next, open the _templatepack.csproj_ file in a code editor and populate it accor ``` -For getting more information about content of _templatepack.csproj_ file, navigate to [Pack a template into a NuGet package (nupkg file)](https://learn.microsoft.com/dotnet/core/tools/custom-templates#pack-a-template-into-a-nuget-package-nupkg-file). +For getting more information about NuGet package metadata available in _AdatumCorporation.Utility.Templates.csproj_ file, navigate to [Pack a template into a NuGet package (nupkg file)](https://learn.microsoft.com/dotnet/core/tools/custom-templates#pack-a-template-into-a-nuget-package-nupkg-file). + +By default, the created project file includes [template authoring MSBuild tasks](https://aka.ms/templating-authoring-tools). + +```xml + + false + + + + + +``` + +Those MSBuild tasks provide template validation and [localization of the templates](https://aka.ms/templating-localization) capabilities. The localization is disabled by default, to enable creation of localization files, set `LocalizeTemplates` to `true`. ## Build and install -Save changes in _templatepack.csproj_ file. Before building the template package, verify that your folder structure is correct. Any custom template should be placed in the _content_ folder, in its own folder. The hierarchy should look similar to: +Save changes in _AdatumCorporation.Utility.Templates.csproj_ file. Before building the template package, verify that your folder structure is correct. Any custom template should be placed in the _content_ folder, in its own folder. The hierarchy should look similar to: ```console working -│ templatepack.csproj +│ AdatumCorporation.Utility.Templates.csproj └───content ├───extensions │ └───.template.config @@ -109,9 +124,9 @@ C:\working> dotnet pack Microsoft (R) Build Engine version 16.8.0+126527ff1 for .NET Copyright (C) Microsoft Corporation. All rights reserved. - Restore completed in 123.86 ms for C:\working\templatepack.csproj. + Restore completed in 123.86 ms for C:\working\AdatumCorporation.Utility.Templates.csproj. - templatepack -> C:\working\bin\Debug\net8.0\templatepack.dll + AdatumCorporation.Utility.Templates -> C:\working\bin\Debug\net8.0\AdatumCorporation.Utility.Templates.dll Successfully created package 'C:\working\bin\Debug\AdatumCorporation.Utility.Templates.1.0.0.nupkg'. ``` From bc5f87e44b0e44b8ca2bf69138fa1a4ddebd9494 Mon Sep 17 00:00:00 2001 From: Vlada Shubina Date: Thu, 13 Jul 2023 12:07:07 +0200 Subject: [PATCH 07/12] Apply suggestions from code review Co-authored-by: Tom Dykstra --- .../cli-templates-create-template-package.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/core/tutorials/cli-templates-create-template-package.md b/docs/core/tutorials/cli-templates-create-template-package.md index 5aa57a2113b24..90a5f521ad840 100644 --- a/docs/core/tutorials/cli-templates-create-template-package.md +++ b/docs/core/tutorials/cli-templates-create-template-package.md @@ -17,7 +17,7 @@ In this part of the series you'll learn how to: > [!div class="checklist"] > -> * Create template package using [Microsoft.TemplateEngine.Authoring.Templates](https://www.nuget.org/packages/Microsoft.TemplateEngine.Authoring.Templates) +> * Create a template package by using the [Microsoft.TemplateEngine.Authoring.Templates](https://www.nuget.org/packages/Microsoft.TemplateEngine.Authoring.Templates) NuGet package. > * Install a template package from a NuGet package file > * Uninstall a template package by package ID @@ -35,20 +35,20 @@ In this part of the series you'll learn how to: A template package is one or more templates packed into a NuGet package. When you install or uninstall a template package, all templates contained in the package are added or removed, respectively. -Template packages are represented by a NuGet package (_.nupkg_) file. And, like any NuGet package, you can upload the template package to a NuGet feed. The `dotnet new install` [command](../tools/dotnet-new-install.md) supports installing template packages from a NuGet package feed. Additionally, you can install a template package from a _.nupkg_ file directly. +Template packages are represented by a NuGet package (_.nupkg_) file. And, like any NuGet package, you can upload the template package to a NuGet feed. The [`dotnet new install`](../tools/dotnet-new-install.md) command supports installing template packages from a NuGet package feed. Additionally, you can install a template package from a _.nupkg_ file directly. Normally you use a C# project file to compile code and produce a binary. However, the project can also be used to generate a template package. By changing the settings of the _.csproj_, you can prevent it from compiling any code and instead include all the assets of your templates as resources. When this project is built, it produces a template package NuGet package. The package you are going to generate will include the [item template](cli-templates-create-item-template.md) and [package template](cli-templates-create-project-template.md) previously created. -In order to create the template package, we will use the template for the template package provided by [Microsoft.TemplateEngine.Authoring.Templates](https://www.nuget.org/packages/Microsoft.TemplateEngine.Authoring.Templates). +In order to create the template package, you will use the template for the template package provided by [Microsoft.TemplateEngine.Authoring.Templates](https://www.nuget.org/packages/Microsoft.TemplateEngine.Authoring.Templates). In your terminal, run the command: ```dotnetcli dotnet new install Microsoft.TemplateEngine.Authoring.Templates ``` -This [template package](https://www.nuget.org/packages/Microsoft.TemplateEngine.Authoring.Templates) contains templates useful for template authoring. Note: nuget.org should be available as NuGet feed inside the working directory to install this template package. +This [template package](https://www.nuget.org/packages/Microsoft.TemplateEngine.Authoring.Templates) contains templates useful for template authoring. To install this package, nuget.org should be available as NuGet feed in the working directory. Navigate to the _working_ folder and run: @@ -58,7 +58,7 @@ dotnet new templatepack --name "AdatumCorporation.Utility.Templates" The `--name` parameter sets the _.csproj_ filename to _AdatumCorporation.Utility.Templates.csproj_. You should see a result similar to the following output. -```console +```output The template "Template Package" was created successfully. Processing post-creation actions... @@ -82,7 +82,7 @@ Next, open the _AdatumCorporation.Utility.Templates.csproj_ file in a code edito ``` -For getting more information about NuGet package metadata available in _AdatumCorporation.Utility.Templates.csproj_ file, navigate to [Pack a template into a NuGet package (nupkg file)](https://learn.microsoft.com/dotnet/core/tools/custom-templates#pack-a-template-into-a-nuget-package-nupkg-file). +To get more information about NuGet package metadata available in the _AdatumCorporation.Utility.Templates.csproj_ file, navigate to [Pack a template into a NuGet package (nupkg file)](https://learn.microsoft.com/dotnet/core/tools/custom-templates#pack-a-template-into-a-nuget-package-nupkg-file). By default, the created project file includes [template authoring MSBuild tasks](https://aka.ms/templating-authoring-tools). @@ -96,7 +96,7 @@ By default, the created project file includes [template authoring MSBuild tasks] ``` -Those MSBuild tasks provide template validation and [localization of the templates](https://aka.ms/templating-localization) capabilities. The localization is disabled by default, to enable creation of localization files, set `LocalizeTemplates` to `true`. +These MSBuild tasks provide template validation and [localization of the templates](https://aka.ms/templating-localization) capabilities. Localization is disabled by default. To enable creation of localization files, set `LocalizeTemplates` to `true`. ## Build and install @@ -114,7 +114,7 @@ working template.json ``` -The _content_ folder has two folders: _extensions_ and _consoleasync_. By default, _content_ also contains _SampleTemplate_, that can safely deleted as it was added to authoring template for demonstration purposes. +The _content_ folder has two folders: _extensions_ and _consoleasync_. By default, _content_ also contains _SampleTemplate_, which can safely be deleted. It was added to the authoring template for demonstration purposes. In your terminal, from the _working_ folder, run the `dotnet pack` command. This command builds your project and creates a NuGet package in the _working\bin\Debug_ folder, as indicated by the following output: From e757ee1da2e7674a430a136418ef112ea608a1a4 Mon Sep 17 00:00:00 2001 From: Vlada Shubina Date: Thu, 13 Jul 2023 12:19:42 +0200 Subject: [PATCH 08/12] try to use zone pivots --- .../cli-templates-create-template-package.md | 199 +++++++++++++++++- 1 file changed, 194 insertions(+), 5 deletions(-) diff --git a/docs/core/tutorials/cli-templates-create-template-package.md b/docs/core/tutorials/cli-templates-create-template-package.md index 90a5f521ad840..d15030bf1fd7f 100644 --- a/docs/core/tutorials/cli-templates-create-template-package.md +++ b/docs/core/tutorials/cli-templates-create-template-package.md @@ -3,12 +3,15 @@ title: Create a template package for dotnet new description: Learn how to create a csproj file that will build a template package for the dotnet new command. author: adegeo ms.date: 02/03/2022 +zone_pivot_groups: dotnet-preview-version ms.topic: tutorial ms.author: adegeo --- # Tutorial: Create a template package +::: zone pivot="dotnet-8-0" + With .NET, you can create and deploy templates that generate projects, files, and even resources. This tutorial is part three of a series that teaches you how to create, install, and uninstall templates for use with the `dotnet new` command. You can view the completed template in the [.NET Samples GitHub repository](https://github.com/dotnet/samples/tree/main/core/tutorials/cli-templates-create-item-template). @@ -29,8 +32,6 @@ In this part of the series you'll learn how to: * Open a terminal. -[!INCLUDE [dotnet6-syntax-note](includes/dotnet6-syntax-note.md)] - ## Create a template package project A template package is one or more templates packed into a NuGet package. When you install or uninstall a template package, all templates contained in the package are added or removed, respectively. @@ -118,7 +119,7 @@ The _content_ folder has two folders: _extensions_ and _consoleasync_. By defaul In your terminal, from the _working_ folder, run the `dotnet pack` command. This command builds your project and creates a NuGet package in the _working\bin\Debug_ folder, as indicated by the following output: -```console +```output C:\working> dotnet pack Microsoft (R) Build Engine version 16.8.0+126527ff1 for .NET @@ -132,6 +133,193 @@ Copyright (C) Microsoft Corporation. All rights reserved. Next, install the template package with the `dotnet new install` command. +```output +C:\working> dotnet new install C:\working\bin\Debug\AdatumCorporation.Utility.Templates.1.0.0.nupkg +The following template packages will be installed: + C:\working\bin\Debug\AdatumCorporation.Utility.Templates.1.0.0.nupkg + +Success: AdatumCorporation.Utility.Templates::1.0.0 installed the following templates: +Templates Short Name Language Tags +-------------------------------------------- ------------------- ------------ ---------------------- +Example templates: string extensions stringext [C#] Common/Code +Example templates: async project consoleasync [C#] Common/Console/C#9 +``` + +If you uploaded the NuGet package to a NuGet feed, you can use the `dotnet new install ` command where `` is the same as the `` setting from the _.csproj_ file. This package ID is the same as the NuGet package identifier. + +## Uninstall the template package + +No matter how you installed the template package, either with the _.nupkg_ file directly or by NuGet feed, removing a template package is the same. Use the `` of the template you want to uninstall. You can get a list of templates that are installed by running the `dotnet new uninstall` command. + +```output +C:\working> dotnet new uninstall +Currently installed items: +... cut to save space ... + + AdatumCorporation.Utility.Templates + Details: + NuGetPackageId: AdatumCorporation.Utility.Templates + Version: 1.0.0 + Author: Me + Templates: + Example templates: async project (consoleasync) C# + Example templates: string extensions (stringext) C# + Uninstall Command: + dotnet new uninstall AdatumCorporation.Utility.Templates +``` + +Run `dotnet new uninstall AdatumCorporation.Utility.Templates` to uninstall the template package. The command will output information about what template packages were uninstalled. + +Congratulations! You've installed and uninstalled a template package. + +## Next steps + +To learn more about templates, most of which you've already learned, see the [Custom templates for dotnet new](../tools/custom-templates.md) article. + +* [Template Authoring Tools](https://aka.ms/templating-authoring-tools) +* [dotnet/templating GitHub repo Wiki](https://github.com/dotnet/templating/wiki) +* [Template samples](https://aka.ms/template-samples) +* [*template.json* schema at the JSON Schema Store](http://json.schemastore.org/template) + +::: zone-end + +::: zone pivot="dotnet-7-0,dotnet-6-0" + +With .NET, you can create and deploy templates that generate projects, files, and even resources. This tutorial is part three of a series that teaches you how to create, install, and uninstall templates for use with the `dotnet new` command. + +You can view the completed template in the [.NET Samples GitHub repository](https://github.com/dotnet/samples/tree/main/core/tutorials/cli-templates-create-item-template). + +In this part of the series you'll learn how to: + +> [!div class="checklist"] +> +> * Create a \*.csproj project to build a template package +> * Configure the project file for packing +> * Install a template package from a NuGet package file +> * Uninstall a template package by package ID + +## Prerequisites + +* Complete [part 1](cli-templates-create-item-template.md) and [part 2](cli-templates-create-project-template.md) of this tutorial series. + + This tutorial uses the two templates created in the first two parts of this tutorial. You can use a different template as long as you copy the template, as a folder, into the _working\templates\\_ folder. + +* Open a terminal and navigate to the _working\\_ folder. + +[!INCLUDE [dotnet6-syntax-note](includes/dotnet6-syntax-note.md)] + +## Create a template package project + +A template package is one or more templates packaged into a NuGet package. When you install or uninstall a template package, all templates contained in the package are added or removed, respectively. The previous parts of this tutorial series only worked with individual templates. To share a non-packed template, you have to copy the template folder and install via that folder. Because a template package can have more than one template in it, and is a single file, sharing is easier. + +Template packages are represented by a NuGet package (_.nupkg_) file. And, like any NuGet package, you can upload the template package to a NuGet feed. The `dotnet new install` command supports installing template package from a NuGet package feed. Additionally, you can install a template package from a _.nupkg_ file directly. + +Normally you use a C# project file to compile code and produce a binary. However, the project can also be used to generate a template package. By changing the settings of the _.csproj_, you can prevent it from compiling any code and instead include all the assets of your templates as resources. When this project is built, it produces a template package NuGet package. + +The package you'll create will include the [item template](cli-templates-create-item-template.md) and [package template](cli-templates-create-project-template.md) previously created. Because we grouped the two templates into the _working\templates\\_ folder, we can use the _working_ folder for the _.csproj_ file. + +In your terminal, navigate to the _working_ folder. Create a new project and set the name to `templatepack` and the output folder to the current folder. + +```dotnetcli +dotnet new console -n templatepack -o . +``` + +The `-n` parameter sets the _.csproj_ filename to _templatepack.csproj_. The `-o` parameter creates the files in the current directory. You should see a result similar to the following output. + +```console +The template "Console Application" was created successfully. + +Processing post-creation actions... +Running 'dotnet restore' on .\templatepack.csproj... + Restore completed in 52.38 ms for C:\working\templatepack.csproj. + +Restore succeeded. +``` + +The new project template generates a _Program.cs_ file. You can safely delete this file as it's not used by the templates. + +Next, open the _templatepack.csproj_ file in your favorite editor and replace the content with the following XML: + +```xml + + + + Template + 1.0 + AdatumCorporation.Utility.Templates + AdatumCorporation Templates + Me + Templates to use when creating an application for Adatum Corporation. + dotnet-new;templates;contoso + + netstandard2.0 + + true + false + content + $(NoWarn);NU5128 + true + + + + + + + + +``` + +The settings under `` in the XML snippet are broken into three groups. + +The first group deals with properties required for a NuGet package. The three `` settings have to do with the NuGet package properties to identify your package on a NuGet feed. Specifically the `` value is used to uninstall the template package with a single name instead of a directory path. It can also be used to install the template package from a NuGet feed. The remaining settings, such as `` and `<PackageTags>`, have to do with metadata displayed on the NuGet feed. For more information about NuGet settings, see [NuGet and MSBuild properties](/nuget/reference/msbuild-targets). + +> [!NOTE] +> To ensure that the template package appears in `dotnet new search` results, set `<PackageType>` to `Template`. + +In the second group, the `<TargetFramework>` setting ensures that MSBuild executes properly when you run the pack command to compile and pack the project. + +The third group includes settings that have to do with configuring the project to include the templates in the appropriate folder in the NuGet pack when it's created: + +* The `<NoWarn>` setting suppresses a warning message that doesn't apply to template package projects. + +* The `<NoDefaultExcludes>` setting ensures that files and folders that start with a `.` (like `.gitignore`) are part of the template. The *default* behavior of NuGet packages is to ignore those files and folders. + +`<ItemGroup>` contains two items. First, the `<Content>` item includes everything in the _templates_ folder as content. It's also set to exclude any _bin_ folder or _obj_ folder to prevent any compiled code (if you tested and compiled your templates) from being included. Second, the `<Compile>` item excludes all code files from compiling no matter where they're located. This setting prevents the project that's used to create the template package from trying to compile the code in the _templates_ folder hierarchy. + +## Build and install + +Save the project file. Before building the template package, verify that your folder structure is correct. Any template you want to pack should be placed in the _templates_ folder, in its own folder. The folder structure should look similar to the following hierarchy: + +```console +working +│ templatepack.csproj +└───templates + ├───extensions + │ └───.template.config + │ template.json + └───consoleasync + └───.template.config + template.json +``` + +The _templates_ folder has two folders: _extensions_ and _consoleasync_. + +In your terminal, from the _working_ folder, run the `dotnet pack` command. This command builds your project and creates a NuGet package in the _working\bin\Debug_ folder, as indicated by the following output: + +```console +C:\working> dotnet pack + +Microsoft (R) Build Engine version 16.8.0+126527ff1 for .NET +Copyright (C) Microsoft Corporation. All rights reserved. + + Restore completed in 123.86 ms for C:\working\templatepack.csproj. + + templatepack -> C:\working\bin\Debug\netstandard2.0\templatepack.dll + Successfully created package 'C:\working\bin\Debug\AdatumCorporation.Utility.Templates.1.0.0.nupkg'. +``` + +Next, install the template package with the `dotnet new install` command. + ```console C:\working> dotnet new install C:\working\bin\Debug\AdatumCorporation.Utility.Templates.1.0.0.nupkg The following template packages will be installed: @@ -175,7 +363,8 @@ Congratulations! You've installed and uninstalled a template package. To learn more about templates, most of which you've already learned, see the [Custom templates for dotnet new](../tools/custom-templates.md) article. -* [Template Authoring Tools](https://github.com/dotnet/templating/tree/main/tools) * [dotnet/templating GitHub repo Wiki](https://github.com/dotnet/templating/wiki) -* [dotnet/dotnet-template-samples GitHub repo](https://github.com/dotnet/dotnet-template-samples) +* [Template samples](https://aka.ms/template-samples) * [*template.json* schema at the JSON Schema Store](http://json.schemastore.org/template) + +::: zone-end From 35b2dc65242fe336ac399ef15c493849410a2fc7 Mon Sep 17 00:00:00 2001 From: Vlada Shubina <vshubina@microsoft.com> Date: Thu, 13 Jul 2023 13:36:53 +0200 Subject: [PATCH 09/12] small adjustments after tutorial dry-run --- .../cli-templates-create-item-template.md | 8 ++--- .../cli-templates-create-project-template.md | 4 +-- .../cli-templates-create-template-package.md | 31 +++++++++---------- 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/docs/core/tutorials/cli-templates-create-item-template.md b/docs/core/tutorials/cli-templates-create-item-template.md index 22eefa5dde620..7fb0884e4d0a4 100644 --- a/docs/core/tutorials/cli-templates-create-item-template.md +++ b/docs/core/tutorials/cli-templates-create-item-template.md @@ -167,7 +167,7 @@ dotnet run You get the following output. ```console -Hello World! +Hello, World! ``` Next, run `dotnet new stringext` to generate the _CommonExtensions.cs_ from the template. @@ -182,10 +182,10 @@ You get the following output. The template "Example templates: string extensions" was created successfully. ``` -Change the code in _Program.cs_ to reverse the `"Hello World"` string with the extension method provided by the template. +Change the code in _Program.cs_ to reverse the `"Hello, World!"` string with the extension method provided by the template. ```csharp -Console.WriteLine("Hello World!".Reverse()); +Console.WriteLine("Hello, World!".Reverse()); ``` Run the program again and you'll see that the result is reversed. @@ -197,7 +197,7 @@ dotnet run You get the following output. ```console -!dlroW olleH +!dlroW ,olleH ``` 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. diff --git a/docs/core/tutorials/cli-templates-create-project-template.md b/docs/core/tutorials/cli-templates-create-project-template.md index b66397adc30e6..26f9572047633 100644 --- a/docs/core/tutorials/cli-templates-create-project-template.md +++ b/docs/core/tutorials/cli-templates-create-project-template.md @@ -12,8 +12,6 @@ recommendations: false With .NET, you can create and deploy templates that generate projects, files, even resources. This tutorial is part two of a series that teaches you how to create, install, and uninstall, templates for use with the `dotnet new` command. -You can view the completed template in the [.NET Samples GitHub repository](https://github.com/dotnet/samples/tree/main/core/tutorials/cli-templates-create-item-template). - > [!TIP] > The official .NET templates that are shipped with the .NET SDK can be found in the following repositories: > @@ -62,7 +60,7 @@ working ## Modify Program.cs -Open up the _program.cs_ file. The standard console project doesn't asynchronously write to the console output, so let's add that. Change the code to the following and save the file: +Open up the _Program.cs_ file. The standard console project doesn't asynchronously write to the console output, so let's add that. Change the code to the following and save the file: ```csharp await Console.Out.WriteAsync("Hello World with C#"); diff --git a/docs/core/tutorials/cli-templates-create-template-package.md b/docs/core/tutorials/cli-templates-create-template-package.md index d15030bf1fd7f..fcb2b9d4b2643 100644 --- a/docs/core/tutorials/cli-templates-create-template-package.md +++ b/docs/core/tutorials/cli-templates-create-template-package.md @@ -54,10 +54,10 @@ This [template package](https://www.nuget.org/packages/Microsoft.TemplateEngine. Navigate to the _working_ folder and run: ```dotnetcli -dotnet new templatepack --name "AdatumCorporation.Utility.Templates" +dotnet new templatepack --output "AdatumCorporation.Utility.Templates" ``` -The `--name` parameter sets the _.csproj_ filename to _AdatumCorporation.Utility.Templates.csproj_. You should see a result similar to the following output. +The `--output` parameter creates the template for template package in _AdatumCorporation.Utility.Templates_ subfolder and sets the _.csproj_ filename to _AdatumCorporation.Utility.Templates.csproj_. You should see a result similar to the following output. ```output The template "Template Package" was created successfully. @@ -67,7 +67,7 @@ Description: Manual actions required Manual instructions: Open *.csproj in the editor and complete the package metadata configuration. Copy the templates to 'content' folder. Fill in README.md. ``` -Next, open the _AdatumCorporation.Utility.Templates.csproj_ file in a code editor and populate it according to the hints in the template: +Next, navigate to _AdatumCorporation.Utility.Templates_ folder, open the _AdatumCorporation.Utility.Templates.csproj_ file in a code editor and populate it according to the hints in the template: ```xml <PropertyGroup> @@ -101,10 +101,12 @@ These MSBuild tasks provide template validation and [localization of the templat ## Build and install -Save changes in _AdatumCorporation.Utility.Templates.csproj_ file. Before building the template package, verify that your folder structure is correct. Any custom template should be placed in the _content_ folder, in its own folder. The hierarchy should look similar to: +Save changes in _AdatumCorporation.Utility.Templates.csproj_ file. +Copy _extensions_ and _consoleasync_ folders with templates created in previous parts of tutorial to _content_ folder. +Before building the template package, verify that your folder structure is correct. Custom templates should be placed in the _content_ folder, in its own folder. The hierarchy should look similar to: ```console -working +AdatumCorporation.Utility.Templates │ AdatumCorporation.Utility.Templates.csproj └───content ├───extensions @@ -117,26 +119,21 @@ working The _content_ folder has two folders: _extensions_ and _consoleasync_. By default, _content_ also contains _SampleTemplate_, which can safely be deleted. It was added to the authoring template for demonstration purposes. -In your terminal, from the _working_ folder, run the `dotnet pack` command. This command builds your project and creates a NuGet package in the _working\bin\Debug_ folder, as indicated by the following output: +In your terminal, from the _AdatumCorporation.Utility.Templates_ folder, run the `dotnet pack` command. This command builds your project and creates a NuGet package in the _working\bin\Debug_ folder, as indicated by the following output: ```output -C:\working> dotnet pack - -Microsoft (R) Build Engine version 16.8.0+126527ff1 for .NET -Copyright (C) Microsoft Corporation. All rights reserved. - - Restore completed in 123.86 ms for C:\working\AdatumCorporation.Utility.Templates.csproj. - - AdatumCorporation.Utility.Templates -> C:\working\bin\Debug\net8.0\AdatumCorporation.Utility.Templates.dll - Successfully created package 'C:\working\bin\Debug\AdatumCorporation.Utility.Templates.1.0.0.nupkg'. +C:\working\AdatumCorporation.Utility.Templates> dotnet pack +... cut to save space ... + AdatumCorporation.Utility.Templates -> C:\\working\AdatumCorporation.Utility.Templates\bin\Release\net8.0\AdatumCorporation.Utility.Templates.dll + Successfully created package 'C:\working\AdatumCorporation.Utility.Templates\bin\Release\AdatumCorporation.Utility.Templates.1.0.0.nupkg'. ``` Next, install the template package with the `dotnet new install` command. ```output -C:\working> dotnet new install C:\working\bin\Debug\AdatumCorporation.Utility.Templates.1.0.0.nupkg +C:\working\AdatumCorporation.Utility.Templates> dotnet new install bin\Release\AdatumCorporation.Utility.Templates.1.0.0.nupkg The following template packages will be installed: - C:\working\bin\Debug\AdatumCorporation.Utility.Templates.1.0.0.nupkg + C:\working\AdatumCorporation.Utility.Templates\bin\Release\AdatumCorporation.Utility.Templates.1.0.0.nupkg Success: AdatumCorporation.Utility.Templates::1.0.0 installed the following templates: Templates Short Name Language Tags From e62b6060f3dac3f132e6ae7b225023a9655c336d Mon Sep 17 00:00:00 2001 From: Tom Dykstra <tdykstra@microsoft.com> Date: Thu, 13 Jul 2023 07:01:07 -0700 Subject: [PATCH 10/12] Fix build warning --- docs/core/tutorials/cli-templates-create-template-package.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/tutorials/cli-templates-create-template-package.md b/docs/core/tutorials/cli-templates-create-template-package.md index fcb2b9d4b2643..90323a3efa023 100644 --- a/docs/core/tutorials/cli-templates-create-template-package.md +++ b/docs/core/tutorials/cli-templates-create-template-package.md @@ -83,7 +83,7 @@ Next, navigate to _AdatumCorporation.Utility.Templates_ folder, open the _Adatum </PropertyGroup> ``` -To get more information about NuGet package metadata available in the _AdatumCorporation.Utility.Templates.csproj_ file, navigate to [Pack a template into a NuGet package (nupkg file)](https://learn.microsoft.com/dotnet/core/tools/custom-templates#pack-a-template-into-a-nuget-package-nupkg-file). +To get more information about NuGet package metadata available in the _AdatumCorporation.Utility.Templates.csproj_ file, navigate to [Pack a template into a NuGet package (nupkg file)](/dotnet/core/tools/custom-templates#pack-a-template-into-a-nuget-package-nupkg-file). By default, the created project file includes [template authoring MSBuild tasks](https://aka.ms/templating-authoring-tools). From f588a0ef64109e69cc67b2eeb28a826454810b7e Mon Sep 17 00:00:00 2001 From: Vlada Shubina <vshubina@microsoft.com> Date: Fri, 14 Jul 2023 12:31:03 +0200 Subject: [PATCH 11/12] fixed the wording --- docs/core/tutorials/cli-templates-create-template-package.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/core/tutorials/cli-templates-create-template-package.md b/docs/core/tutorials/cli-templates-create-template-package.md index 90323a3efa023..e0a0cd4dd39bb 100644 --- a/docs/core/tutorials/cli-templates-create-template-package.md +++ b/docs/core/tutorials/cli-templates-create-template-package.md @@ -30,7 +30,7 @@ In this part of the series you'll learn how to: This tutorial uses the two templates created in the first two parts of this tutorial. You can use a different template as long as you copy the template, as a folder, into the _working\templates\\_ folder. -* Open a terminal. +* Open a terminal and navigate to the _working\\_ folder. ## Create a template package project @@ -51,7 +51,7 @@ dotnet new install Microsoft.TemplateEngine.Authoring.Templates This [template package](https://www.nuget.org/packages/Microsoft.TemplateEngine.Authoring.Templates) contains templates useful for template authoring. To install this package, nuget.org should be available as NuGet feed in the working directory. -Navigate to the _working_ folder and run: +Run the following command to create the template for template package: ```dotnetcli dotnet new templatepack --output "AdatumCorporation.Utility.Templates" From 7debcb44e4ce4607ffdcbc4697249367ad862bb1 Mon Sep 17 00:00:00 2001 From: Tom Dykstra <tdykstra@microsoft.com> Date: Fri, 14 Jul 2023 11:30:13 -0700 Subject: [PATCH 12/12] Update docs/core/tutorials/cli-templates-create-template-package.md --- docs/core/tutorials/cli-templates-create-template-package.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/tutorials/cli-templates-create-template-package.md b/docs/core/tutorials/cli-templates-create-template-package.md index e0a0cd4dd39bb..2b535e24f5c21 100644 --- a/docs/core/tutorials/cli-templates-create-template-package.md +++ b/docs/core/tutorials/cli-templates-create-template-package.md @@ -51,7 +51,7 @@ dotnet new install Microsoft.TemplateEngine.Authoring.Templates This [template package](https://www.nuget.org/packages/Microsoft.TemplateEngine.Authoring.Templates) contains templates useful for template authoring. To install this package, nuget.org should be available as NuGet feed in the working directory. -Run the following command to create the template for template package: +Run the following command to create the template for the template package: ```dotnetcli dotnet new templatepack --output "AdatumCorporation.Utility.Templates"