Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2013/2015 C++ Item Templates Missing

I am trying to make some simple Item Templates for Visual Studio 2013 (Professional) C++ projects, but Visual Studio seems to be fighting with me. I started using the File -> Export Template... wizard, which completed and generated a zip file, but alas, the new template was nowhere to be seen on the Add New Item dialog, so I started manually editing it to see if I could fix it.

Here is my test .vstemplate file:

<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
  <TemplateData>
    <DefaultName>test</DefaultName>
    <Name>Test</Name>
    <Description>Test item template.</Description>
    <ProjectType>VC</ProjectType>
    <!--<SortOrder>10</SortOrder>-->
    <Icon>icon.ico</Icon>
  </TemplateData>
  <TemplateContent>
    <ProjectItem TargetFileName="$fileinputname$.h" ReplaceParameters="true">test.h</ProjectItem>
  </TemplateContent>
</VSTemplate>

I've tried using both VC and VisualC for <ProjectType> and placing the template in various folders, in both zipped and expanded forms.

After changing <ProjectType> to CSharp and creating a C# project it shows up immediately. Interestingly, if the %USERPROFILE%\Documents\Visual Studio 2013\Templates\ItemTemplates\Visual C# directory is empty, the template will now show up if it is in %USERPROFILE%\Documents\Visual Studio 2013\Templates\ItemTemplates or %USERPROFILE%\Documents\Visual Studio 2013\Templates\ItemTemplates\Visual C++ Project directories, but if a copy of it is also in the Visual C# directory it shows up twice in the new item dialog...

I know there was a bug with the Visual Studio 2013 Express RC where the New Item dialog wouldn't show any templates at all, even the built-in ones, so I'm thinking this might be a bug in Visual Studio, or just another example of Microsoft's disturbing disregard for C++.

Is there something I'm missing here or is this a bug with VS2013? If so does anyone know of any workaround?

Edit: This problem still exists in Visual Studio 2015 RC

like image 527
bcrist Avatar asked Dec 31 '13 13:12

bcrist


People also ask

Where can I find templates in Visual Studio?

By default, user templates are located in: %USERPROFILE%\Documents\Visual Studio 2019\Templates\ProjectTemplates. %USERPROFILE%\Documents\Visual Studio 2019\Templates\ItemTemplates.


1 Answers

Having the same problem. The workaround that works for me is to use the VS2013 Express edition, where C++ Item templates work just fine (just like they did in VS2012 Pro/Express). I have no clue why this handy functionality has been removed from the Pro edition but keeps on working in the free express edition.

like image 190
Johnny Hendriks Avatar answered Oct 06 '22 10:10

Johnny Hendriks