VS2010 项目模板 +虚拟机软件开发工具包
除了默认的 ItemTemplate(如“添加新项目”中所示)
在我的一生中,我无法将我的 DSL 项目导出为模板, 创建一个新项目? VSTemplate如下。已尝试将 zip 作为内容(ProjTemplate)添加到 VSIX,但无济于事。
<!--DSL Tools Language Template-->
<VSTemplate Version="3.0.0" Type="Item" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<TemplateData>
<Name Package="{602c1894-d640-407a-a311-aca9d5ab7a5c}" ID="103"/>
<Description Package="{602c1894-d640-407a-a311-aca9d5ab7a5c}" ID="102"/>
<Icon Package="{602c1894-d640-407a-a311-aca9d5ab7a5c}" ID="201" />
<ProjectType>CSharp</ProjectType>
<SortOrder>360</SortOrder>
<DefaultName>FlowDsl.mhf</DefaultName>
</TemplateData>
<TemplateContent>
<ProjectItem TargetFileName="$fileinputname$.mhf">mhf.mhf</ProjectItem>
<ProjectItem TargetFileName="$fileinputname$.mhf.diagram">mhf.diagram</ProjectItem>
</TemplateContent>
</VSTemplate>
谢谢;
For the life of me, I can't get my DSL project to be exported as a template, other than the default ItemTemplate (as in Add New Item)
Does anyone happen to have a summary of what has to be done to be able to create a new project? VSTemplate follows. Have tried adding the zip to the VSIX as Content (ProjTemplate) to no avail.
<!--DSL Tools Language Template-->
<VSTemplate Version="3.0.0" Type="Item" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<TemplateData>
<Name Package="{602c1894-d640-407a-a311-aca9d5ab7a5c}" ID="103"/>
<Description Package="{602c1894-d640-407a-a311-aca9d5ab7a5c}" ID="102"/>
<Icon Package="{602c1894-d640-407a-a311-aca9d5ab7a5c}" ID="201" />
<ProjectType>CSharp</ProjectType>
<SortOrder>360</SortOrder>
<DefaultName>FlowDsl.mhf</DefaultName>
</TemplateData>
<TemplateContent>
<ProjectItem TargetFileName="$fileinputname$.mhf">mhf.mhf</ProjectItem>
<ProjectItem TargetFileName="$fileinputname$.mhf.diagram">mhf.diagram</ProjectItem>
</TemplateContent>
</VSTemplate>
Thanks;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来您想要一个项目模板,对吗?对于初学者,VSTemplate 元素上的 Type 属性应为
Type="Project"
,而不是Type="Item"
。此外,项目模板需要在
中具有
元素(通常是 csproj/vbproj 文件)才能用作一个入门项目。我建议创建一个 C# 或 VB 项目,并将 DSL 实例作为项目项(并按照您想要的模板构建项目)。然后,尝试使用 导出模板向导,使用您的项目模板创建 VSIX。
如果您想进一步自定义和控制模板中的内容,请查看 这篇博文介绍了如何手动创作和打包模板。
It sounds like you want a project template, correct? For starters, the Type attribute on the VSTemplate element should be
Type="Project"
instead ofType="Item"
. Additionally, project templates need to have a<Project>
element (usually a csproj/vbproj file) in the<TemplateContent>
to use as a starter project.I would suggest creating a C# or VB project with an instance of your DSL as a project item (and structuring the project as you would want your template). Then, try using the Export Template Wizard to create a VSIX with your project template.
If you want to further customize and control what is in the template, check out this blog post which describes how to manually author and package your templates.