Question

Given demo solution with two VSX-projects: 1. Add New Project -> Extensibility -> Item Template - "ItemTemplate1" 2. Add New Project -> Extensibility -> VSIX Project - "VSIXProject1"

I did no changes in "ItemTemplate1", so it constains default item template (ItemTemplate1.vstemplate):

<VSTemplate Version="3.0.0" Type="Item" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
<TemplateData>
  <Name>ItemTemplate1</Name>
  <Description>&lt;No description available&gt;</Description>
  <Icon>ItemTemplate1.ico</Icon>
  <TemplateID>e298765c-97b8-4f4c-9b7b-a6b368f914df</TemplateID>
  <ProjectType>CSharp</ProjectType>
  <RequiredFrameworkVersion>2.0</RequiredFrameworkVersion>
  <NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
  <DefaultName>Class.cs</DefaultName>
</TemplateData>
<TemplateContent>
    <References>
        <Reference>
            <Assembly>System</Assembly>
        </Reference>
    </References>
  <ProjectItem ReplaceParameters="true">Class.cs</ProjectItem>
</TemplateContent>
</VSTemplate>

In VSIXProject1 I only edited source.extension.vsixmanifest adding reference to ItemTemplates1 project. After this vsixmanifest contains only one content description:

<Content>
    <ItemTemplate>ItemTemplates</ItemTemplate>
</Content>

Then built it. In bin/debug I got VSIXProject1.vsix inside which I can see my item template in ItemTemplates\CSharp\1033\ItemTemplate1.zip file.

Everything looks great!

Except the fact it doesn't work. I run VSIXProject1.vsix, vsix installed (I can see it in the extension manager) but no any templates was copied to "C:\Users\{UserName}\Documents\Visual Studio 2010\Templates\ItemTemplates" !

Was it helpful?

Solution

Templates that are installed through a VSIX don't get installed to the Templates folder in the user Documents folder. They get installed under %LocalAppData%\Microsoft\VisualStudio\10.0\Extensions\<YourExtensionFolder> with all the other content for that extension. (A VSIX install is basically just unzipping the VSIX to a folder.)

You should still be able to see the template when you try to add a new item to a C# project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top