I have created and imported an Item Template, a C# class template for use in Visual Studio.
When I open a C# Class Library project I can create a new item from this template with Add > Class > UniqueIdentifier
. This works as expected.
When I open an ASP .Net Core MVC project and try the same options, this template does not appear in the list. This is not expected.
I'd like this Item Template to appear in the Add > Class
menu for all of my projects. I have tried modifying the .vstemplate
file, but I have only been able to switch it between appearing in a different one of the two project types I've tried. I can't get it to appear in multiple types of projects.
Here's the current contents of the TemplateData
section of the .vstemplate
file:
<TemplateData>
<DefaultName>UniqueIdentifier.cs</DefaultName>
<Name>UniqueIdentifier</Name>
<Description>My Description</Description>
<ProjectType>CSharp</ProjectType>
<TemplateID>Microsoft.CSharp.Class</TemplateID>
<Icon>__TemplateIcon.png</Icon>
<PreviewImage>__PreviewImage.PNG</PreviewImage>
<ShowByDefault>true</ShowByDefault>
</TemplateData>
<TemplateGroupID>AspNetCore</TemplateGroupID>
so this was the key to making it work for me. – Copper