Reputation: 8414
I have a dotnet new
template project that consists of three templates:
Project source can be found here (it's FOSS): https://github.com/petabridge/petabridge-dotnet-new/
I've followed the best practices outlined here https://learn.microsoft.com/en-us/dotnet/core/tools/custom-templates and created a .csproj
that targets all three templates:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageType>Template</PackageType>
<PackageVersion>1.0</PackageVersion>
<PackageId>Petabridge.Templates</PackageId>
<Title>Petabridge.Templates</Title>
<Authors>Petabridge</Authors>
<Description>Professional .NET Core templates complete with CI, Docs, and more. Supports library, Akka.NET, and ASP.NET Core application types.</Description>
<PackageTags>dotnet-new;templates;petabridge;akka;</PackageTags>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageReleaseNotes></PackageReleaseNotes>
<IncludeContentInPack>true</IncludeContentInPack>
<IncludeBuildOutput>false</IncludeBuildOutput>
<ContentTargetFolders>content</ContentTargetFolders>
</PropertyGroup>
<ItemGroup>
<Content Include="templates\**\*" Exclude="templates\**\bin\**;templates\**\obj\**" />
<Compile Remove="**\*" />
</ItemGroup>
</Project>
Live version of this source can be found here: https://github.com/petabridge/petabridge-dotnet-new/blob/dev/src/Petabridge.Templates.csproj
After I run the build script and check the package output, I can see the NuGet package that was built as part of the package output definitely contains all three templates inside of it - you can download the signed version of this package from the Github Release on this repository: https://github.com/petabridge/petabridge-dotnet-new/releases/tag/1.0.1
My issue is, that when I install these templates onto my machine using the latest .NET Core 3.0 SDK, I only see the third template (web application) show up in the install list:
PS> dotnet new -i "Petabridge.Templates::*"
What am I doing wrong? Why does only one template show up when I install this package? All relevant source, template configs, et al can be found through the click-through on the repository links I included.
Upvotes: 2
Views: 1872
Reputation: 644
I had the same problem. I solved it by having a different value for groupIdentity inside the template.json file of each template.
https://github.com/dotnet/templating/wiki/%22Runnable-Project%22-Templates#configuration
groupIdentity (optional)
The ID of the group this template belongs to. When combined with the tags section, this allows multiple templates to be displayed as one, with the the decision for which one to use being presented as a choice in each one of the pivot categories (keys).
Upvotes: 3