What settings should be used to get custom ItemTemplates working with .NET Core projects?

Viewed 4106

I have a Visual Studio 2017 item template extension that is currently working with ASP.NET projects. It has the following .vstemplate:

<VSTemplate Version="3.0.0" Type="Item" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" xmlns:sdk="http://schemas.microsoft.com/developer/vstemplate-sdkextension/2010">
  <TemplateData>
    <Name>Angular Component</Name>
    <Description>Files for an Angular component</Description>
    <RequiredFrameworkVersion>4.5</RequiredFrameworkVersion>
    <Icon>AngularComponentTemplate.ico</Icon>
    <ProjectType>CSharp</ProjectType>
    <ProjectSubType>Web</ProjectSubType>
    <NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
  </TemplateData>
  <TemplateContent>
    <ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$.component.html">base.component.html</ProjectItem>
    <ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$.component.ts">base.component.ts</ProjectItem>
  </TemplateContent>
</VSTemplate>

Additionally the VSIX file referencing it has

ItemTemplates\CSharp\Web

set for the "VSIX Sub Path" property of the project.

I cannot, however, get this template to appear in ASP.NET Core projects. I tried using this in the vstemplate:

<ProjectType>DNX</ProjectType>
<TemplateGroupID>SharedDotNetAndDotNetWeb</TemplateGroupID>

(from https://stackoverflow.com/a/38543920/1783619) but it didn't work. In the released version of Visual Stuido 2017, how do I get item templates to appear in .NET core projects?

2 Answers

The most important thing is

<TemplateGroupID>AspNetCore</TemplateGroupID>

Otherwise you will not see your item template from ASP.NET core project.

Strange thing is that you will see your item template with other project (desktop for example).

Hoping that Microsoft will document or make things easier one day

Related