Skip to content

Commit 4ab8598

Browse files
authored
Remove .NET 6/7 zone pivots (#43720)
1 parent 8194bd2 commit 4ab8598

13 files changed

+2
-3045
lines changed

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

Lines changed: 1 addition & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ title: Create a template package for dotnet new
33
description: Learn how to create a csproj file that builds a template package for the dotnet new command.
44
author: adegeo
55
ms.date: 09/11/2023
6-
zone_pivot_groups: dotnet-version
76
ms.topic: tutorial
87
ms.author: adegeo
98
---
@@ -16,27 +15,12 @@ You can view the completed template in the [.NET Samples GitHub repository](http
1615

1716
In this part of the series you'll learn how to:
1817

19-
::: zone pivot="dotnet-9-0,dotnet-8-0"
20-
2118
> [!div class="checklist"]
2219
>
2320
> * Create a template package by using the [Microsoft.TemplateEngine.Authoring.Templates](https://www.nuget.org/packages/Microsoft.TemplateEngine.Authoring.Templates) NuGet package.
2421
> * Install a template package from a NuGet package file.
2522
> * Uninstall a template package by package ID.
2623
27-
::: zone-end
28-
29-
::: zone pivot="dotnet-7-0,dotnet-6-0"
30-
31-
> [!div class="checklist"]
32-
>
33-
> * Create a \*.csproj project to build a template package.
34-
> * Configure the project file for packing.
35-
> * Install a template package from a NuGet package file.
36-
> * Uninstall a template package by package ID.
37-
38-
::: zone-end
39-
4024
## Prerequisites
4125

4226
* Complete [part 1](cli-templates-create-item-template.md) and [part 2](cli-templates-create-project-template.md) of this tutorial series.
@@ -45,21 +29,11 @@ In this part of the series you'll learn how to:
4529

4630
* Open a terminal and navigate to the _working_ folder.
4731

48-
::: zone pivot="dotnet-8-0"
49-
50-
* Install .NET 8.
32+
* Install .NET 8 or .NET 9.
5133
* Install the `Microsoft.TemplateEngine.Authoring.Templates` template from the NuGet package feed.
5234

5335
* Run the `dotnet new install Microsoft.TemplateEngine.Authoring.Templates` command from your terminal.
5436

55-
::: zone-end
56-
57-
::: zone pivot="dotnet-7-0,dotnet-6-0"
58-
59-
[!INCLUDE [dotnet6-syntax-note](includes/dotnet6-syntax-note.md)]
60-
61-
::: zone-end
62-
6337
## Create a template package project
6438

6539
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.
@@ -70,8 +44,6 @@ Normally you use a C# project file to compile code and produce a binary. However
7044

7145
The package you're going to generate will include the [item](cli-templates-create-item-template.md) and [project](cli-templates-create-project-template.md) templates previously created.
7246

73-
::: zone pivot="dotnet-8-0"
74-
7547
The [Microsoft.TemplateEngine.Authoring.Templates](https://www.nuget.org/packages/Microsoft.TemplateEngine.Authoring.Templates) package contains templates useful for template authoring. To install this package, nuget.org should be available as NuGet feed in the working directory.
7648

7749
01. In the _working_ folder, run the following command to create the template package:
@@ -116,63 +88,6 @@ The [Microsoft.TemplateEngine.Authoring.Templates](https://www.nuget.org/package
11688
... cut for brevity ...
11789
```
11890
119-
::: zone-end
120-
121-
::: zone pivot="dotnet-7-0,dotnet-6-0"
122-
123-
01. In the _working_ folder, run the following command to create the template package:
124-
125-
```dotnetcli
126-
dotnet new console -n AdatumCorporation.Utility.Templates
127-
```
128-
129-
The `-n` parameter sets the project file name to _AdatumCorporation.Utility.Templates.csproj_. You should see a result similar to the following output.
130-
131-
```output
132-
The template "Console Application" was created successfully.
133-
134-
Processing post-creation actions...
135-
Running 'dotnet restore' on .\AdatumCorporation.Utility.Templates.csproj...
136-
Restore completed in 52.38 ms for C:\code\working\AdatumCorporation.Utility.Templates.csproj.
137-
138-
Restore succeeded.
139-
```
140-
141-
01. Delete the _Program.cs_ file. The new project template generates this file but it's not used by the templates engine.
142-
143-
01. Next, open the _AdatumCorporation.Utility.Templates.csproj_ file in your favorite editor and replace the content with the following XML:
144-
145-
```xml
146-
<Project Sdk="Microsoft.NET.Sdk">
147-
148-
<PropertyGroup>
149-
<PackageId>AdatumCorporation.Utility.Templates</PackageId>
150-
<PackageVersion>1.0</PackageVersion>
151-
<Title>AdatumCorporation Templates</Title>
152-
<Authors>Me</Authors>
153-
<Description>Templates to use when creating an application for Adatum Corporation.</Description>
154-
<PackageTags>dotnet-new;templates;adatum</PackageTags>
155-
<PackageProjectUrl>https://your-url</PackageProjectUrl>
156-
157-
<PackageType>Template</PackageType>
158-
<TargetFramework>netstandard2.0</TargetFramework>
159-
<IncludeContentInPack>true</IncludeContentInPack>
160-
<IncludeBuildOutput>false</IncludeBuildOutput>
161-
<ContentTargetFolders>content</ContentTargetFolders>
162-
<NoWarn>$(NoWarn);NU5128</NoWarn>
163-
<NoDefaultExcludes>true</NoDefaultExcludes>
164-
</PropertyGroup>
165-
166-
<ItemGroup>
167-
<Content Include="content\**\*" Exclude="content\**\bin\**;content\**\obj\**" />
168-
<Compile Remove="**\*" />
169-
</ItemGroup>
170-
171-
</Project>
172-
```
173-
174-
::: zone-end
175-
17691
### Description of the project XML
17792
17893
The settings under `<PropertyGroup>` in the XML snippet are broken into two groups.
@@ -193,8 +108,6 @@ In the second group, the `<TargetFramework>` setting ensures that MSBuild runs p
193108
> [!TIP]
194109
> For more information about NuGet metadata settings, see [Pack a template into a NuGet package (nupkg file)](../tools/custom-templates.md#pack-a-template-into-a-nuget-package-nupkg-file).
195110
196-
::: zone pivot="dotnet-8-0"
197-
198111
The created project file includes [template authoring MSBuild tasks](https://aka.ms/templating-authoring-tools) and localization settings.
199112
200113
```xml
@@ -212,8 +125,6 @@ The created project file includes [template authoring MSBuild tasks](https://aka
212125
213126
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`.
214127

215-
::: zone-end
216-
217128
## Pack and install
218129

219130
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:

0 commit comments

Comments
 (0)