views:

102

answers:

1

Hi, 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"&gt;
<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" !

+2  A: 

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.

Aaron Marten
Thank you, Aaron.You're right indeed, I just found one my (probably old) template in User's Documents folder and decided it's the right place. Moreover VS2010 does search templates in the User's Documents folder and unlike LocalAppData's place does this without a need of restarting. That fact put me out. (As I installed a vsix, see no template then copy them to User's Documents and do see template)
Shrike

related questions