VS2010:VSIX安装未在其中部署项目模板 [英] VS2010: VSIX installation doesn't deploy item templates inside it
问题描述
给出带有两个VSX项目的演示解决方案: 1.添加新项目->可扩展性->项目模板-"ItemTemplate1" 2.添加新项目->可扩展性-> VSIX项目-"VSIXProject1"
Given demo solution with two VSX-projects: 1. Add New Project -> Extensibility -> Item Template - "ItemTemplate1" 2. Add New Project -> Extensibility -> VSIX Project - "VSIXProject1"
我没有对"ItemTemplate1"进行任何更改,因此它包含默认项目模板(ItemTemplate1.vstemplate):
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><No description available></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>
在VSIXProject1中,我仅编辑了source.extension.vsixmanifest,添加了对ItemTemplates1项目的引用.在此之后,vsixmanifest仅包含一个内容描述:
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>
然后建立它.在bin/debug中,我得到了VSIXProject1.vsix,在其中可以在ItemTemplates \ CSharp \ 1033 \ ItemTemplate1.zip文件中看到我的项目模板.
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.
一切看起来都很棒!
除非它不起作用.我运行VSIXProject1.vsix,安装了vsix(我可以在扩展管理器中看到它)但是没有任何模板被复制到 "C:\ Users \ {UserName} \ Documents \ Visual Studio 2010 \ Templates \ ItemTemplates"!
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" !
推荐答案
通过VSIX安装的模板不会安装到用户Documents文件夹中的Templates文件夹中.它们安装在%LocalAppData%\ Microsoft \ VisualStudio \ 10.0 \ Extensions \< YourExtensionFolder>下.以及该扩展程序的所有其他内容. (安装VSIX基本上只是将VSIX解压缩到一个文件夹中.)
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.)
当您尝试向C#项目中添加新项目时,您仍然应该能够看到模板.
You should still be able to see the template when you try to add a new item to a C# project.
这篇关于VS2010:VSIX安装未在其中部署项目模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!