Visual Studio 2013/2015 C ++ element templates are missing

I am trying to create some simple element templates for Visual Studio 2013 (Professional) projects in C ++, but Visual Studio seems to be struggling with me. I started using the File -> Export Template... wizard, which completed and created the zip file, but, alas, the new template was not shown anywhere in the Add New Item dialog box, so I started to manually edit it to check if I can 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 tried to use both VC and VisualC for <ProjectType> and place the template in different folders in both zipped and extended forms.

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

I know that there was an error with Visual Studio 2013 Express RC, where in the New Element dialog there were no templates at all, even built-in ones, so I think this could be an error in Visual Studio, or just another example Microsoft violates C ++ neglect.

Is there something I am missing here or is this a bug with VS2013? If anyone knows of a workaround?

Edit: This problem still exists in Visual Studio 2015 RC

+8
c ++ visual-c ++ visual-studio visual-studio-2013 visual-studio-2015
source share
2 answers

With the same problem. The workaround that works for me is to use the version of VS2013 Express, where the C ++ element templates work just fine (as in VS2012 Pro / Express). I do not know why this convenient functionality was removed from the Pro version, but it continues to work in the free express version.

+5
source share

My first adventure with VS patterns, and I stumble upon this! Jackpot!

After a few hours of messing around, I can now add my own templates, at least in VS Community 2013. I think the trick is to add <TemplateGroupID>WinRT-Common</TemplateGroupID> . For reference, this element template is displayed to me in an empty C ++ project:

 <?xml version="1.0" encoding="utf-8"?> <VSTemplate Version="3.0.0" Type="Item" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005"> <TemplateData> <Name>GameEngine Core Class</Name> <Description>Creates a header and source file for a new GameEngine Core class.</Description> <Icon>__TemplateIcon.png</Icon> <TemplateGroupID>WinRT-Common</TemplateGroupID> <ProjectType>VC</ProjectType> <DefaultName>GameEngineClassName</DefaultName> </TemplateData> <TemplateContent> <ProjectItem TargetFileName="$fileinputname$.cpp" ReplaceParameters="true" OpenInEditor="true">GameEngineClass.cpp</ProjectItem> <ProjectItem TargetFileName="$fileinputname$.h" ReplaceParameters="true" OpenInEditor="true">GameEngineClass.h</ProjectItem> </TemplateContent> </VSTemplate> 

For default TemplateGroupID ( VC-Native ) and VC-Windows work ( here is the full list). I am not sure what further consequences for hosting WinRT-Common could be. He is not even indicated.

A few more details: I started experimenting with ComputeShader.vstemplate , which comes with VS2013, putting it in the templates folder and changing the file until it becomes what it is now. Somewhere along the way, I realized that it’s very important to put everything in a .zip file, although it seems to work from the beginning, because Visual Studio will ultimately be very strange when it comes to pattern detection (it was rather unpleasant before than I understood that). I assume this is due to the cache.

0
source share

All Articles