Custom ItemTemplate does not appear in the Visual Studio 2015 Add New Item dialog

I looked through this question and did not solve my problem.

I am trying to create a new ItemTemplate in Visual Studio 2015. I started by creating a template in Visual Studio, and then using the "Export Template" option in the "File" menu.

I selected the "Element Template" in the Template Export Wizard, selected my project and selected the file that will serve as the template. I filled in the template parameters and clicked "Finish" on "Automatically import the template into Visual Studio" and "Show Explorer window in the output files folder".

The explorer window that opened showed my template in a zip archive. I went over to %My Documents%\Visual Studio 2015\Templates\ItemTemplatesand found that the zip archive is also in this folder.

Then I went to the Add New Element dialog box, but could not find my template specified in any category or in the main category of Visual C # elements.

I unpacked the archive and found the following for the files included inside:

MyTemplate.vstemplate

<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
  <TemplateData>
    <DefaultName>MyTemplate.cs</DefaultName>
    <Name>MyTemplate</Name>
    <Description>MyTemplate</Description>
    <ProjectType>CSharp</ProjectType>
    <SortOrder>10</SortOrder>
    <Icon>__TemplateIcon.ico</Icon>
  </TemplateData>
  <TemplateContent>
    <References />
    <ProjectItem SubType="" TargetFileName="$fileinputname$.cs" ReplaceParameters="true">Template.cs</ProjectItem>
  </TemplateContent>
</VSTemplate>

Template.cs

using System;
using System.Linq;

namespace $rootnamespace$
{
    public partial class $safeitemname$
    {
        public void $safeitemname$()
        {
            throw new NotImplementedException();
        }
    }
}

What i tried

I tried to open the developer command line for VS2015 as an administrator and enter the following commands (not one after another):

devenv /installvstemplates
devenv /setup
devenv /resetsettings

I tried restarting my computer and instance of Visual Studio several times.

I tried to manually clear the cache folders and rebuild them (despite the fact that they have nothing to do with custom ItemTemplates, as far as I can tell).

, , %My Documents%\Visual Studio 2015\Templates\ItemTemplates , Visual Studio.

Tools > Options > Projects and Solutions , . , .

.zip ItemTemplates.

.zip VS ItemTemplates.

MSDN, . , , , , , .

? - ?

, , - .

Visual Studio - 14.0.23107.0

+4
1

, , , - .

, , Export Template. :

MyTemplate.zip
|-MyTemplate
  |-MyTemplate.vstemplate
  |-MyCodeFile.cs
  |-MyIcon.ico

Visual Studio .

, :

MyTemplate.zip
|-MyTemplate.vstemplate
|-MyCodeFile.cs
|-MyIcon.ico

Windows Send to > Compressed (zipped) folder, , , , Export Template.

+4

All Articles