VSTemplate multi-file template not showing/working

Viewed 11

I need to create three files several times in a project, with references to each other by a name convention. VS Item Templates seemed like an easy way to escape the hunt-and-peck copy-pasta-rename headache.

According to the docs it's possible to create a multi-file item template. The built-in VS2022 exporter only allows the selection of one file.

So I exported a single file, tried loading that up in VS2022, and it worked.

I then went on a search, found the aforementioned doc, added my other files, reloaded the template, and now it does not appear in the Add -> New Item menu.

<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
  <TemplateData>
    <DefaultName>EfVueMantleMSC.cs</DefaultName>
    <Name>EfVueMantleMSC</Name>
    <Description>Create Model, Service, and Controller classes for EfVueMantle in one shot</Description>
    <ProjectType>CSharp</ProjectType>
    <SortOrder>10</SortOrder>
    <Icon>__TemplateIcon.ico</Icon>
  </TemplateData>
  <TemplateContent>
    <References />
      <ProjectItem SubType="" TargetFileName="$fileinputname$Controller.cs" ReplaceParameters="true">ControllerTemplate.cs</ProjectItem>
      <ProjectItem SubType="" TargetFileName="$fileinputname$Model.cs" ReplaceParameters="true">ModelTemplate.cs</ProjectItem>
      <ProjectItem SubType="" TargetFileName="$fileinputname$Service.cs" ReplaceParameters="true">ServiceTemplate.cs</ProjectItem>
  </TemplateContent>
</VSTemplate>

The .zip folder has all three class files, names matching the above. It's in the right place, I can load/unload single-file templates exported from VS2022 without issue. I've dug through a bunch of Q&A about earlier VS versions with this issue, but everything seems in order.

Is there something obviously wrong? Is there a straightforward way to debug when a template doesn't load, like some sort of log?

Are the MS Docs just lying again?

0 Answers
Related