0

I tried making an item template. In the zip I put the files module.cpp, module.h, module.ico and module.vstemplate. The vstemplate file is:

<VSTemplate Type="Item" Version="2.0.0"
    xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
    <TemplateData>
        <Name>C++ cpp/h pair (st)</Name>
        <Description></Description>
        <Icon>module.ico</Icon>
        <ProjectType>VisualC</ProjectType>
        <DefaultName>MyClass</DefaultName>
    </TemplateData>
    <TemplateContent>
        <ProjectItem TargetFileName="$fileinputname$.cpp">module.cpp</ProjectItem>
        <ProjectItem TargetFileName="$fileinputname$.h">module.h</ProjectItem>
    </TemplateContent>
</VSTemplate>

I copied this to the "custom item templates" dir (not the systemwide one): Documents\Visual Studio 2010\Templates\ItemTemplates\VisualC\module.zip

The VisualC folder wasn't there, I created it because I saw one called VisualC in the systemwide templates dir.

I've tried restarting VS. I also tried the "devenv /installvstemplates" thing just in case.

Stefan Monov
  • 11,332
  • 10
  • 63
  • 120
  • I'm curious to know if you ever found a solution to this. I've spent the last hour googling for this same problem and have come up with nothing. – JBentley Nov 15 '12 at 19:59
  • 2
    Have you tried changing `VisualC` to `VC`? Not explicitly documented but that's what VC2012 uses for both project and item templates. – alecov Feb 12 '13 at 15:33
  • Alek's comment is the correct answer to this question. – Pavel Minaev Jul 19 '13 at 01:02
  • No, whatever I do, nothing works. I can create custom items for C# or VB, but C++ (no matter if VisualC or VC) is ignored. Any ideas? Working with VS2013 though. – HelloWorld Sep 11 '14 at 19:20

1 Answers1

0

There is a small note on ItemTemplates page on MSDN:

You cannot export templates for C++ projects.

Fortunately there is a solution, but much more complex than you expect. Search MSDN for Visual C++ Wizards (sorry reputation too low to paste more links).

Starting point could be:

http://msdn.microsoft.com/en-us/library/vstudio/96xz4cw2(v=vs.100).aspx

http://msdn.microsoft.com/en-us/library/aa730846(VS.80).aspx

Pawel Hofman
  • 1,326
  • 11
  • 10