如何在Visual Studio 2013中创建多项目模板? [英] How to create a multi project template in visual studio 2013?

查看:144
本文介绍了如何在Visual Studio 2013中创建多项目模板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了如何:创建多项目模板文章以创建一个模板,该模板将生成包含4个项目的解决方案.我的Root.vstemplate文件包含以下内容

<VSTemplate Version="2.0.0" Type="ProjectGroup"
xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
<TemplateData>
    <Name>Yugasat BeyondAdmin</Name>
    <Description>The Yugasat BeyondAdmin Project Template</Description>
    <Icon>Icon.ico</Icon>
    <ProjectType>CSharp</ProjectType>
</TemplateData>
<TemplateContent>
    <ProjectCollection>
        <ProjectTemplateLink ProjectName="PresentationLayer">
            PresentationLayer\MyTemplate.vstemplate
        </ProjectTemplateLink>
        <ProjectTemplateLink ProjectName="BusinessLogicLayer">
            BusinessLogicLayer\MyTemplate.vstemplate
        </ProjectTemplateLink>
        <ProjectTemplateLink ProjectName="BusinessLogicLayerAPI">
            BusinessLogicLayerAPI\MyTemplate.vstemplate
        </ProjectTemplateLink>
        <ProjectTemplateLink ProjectName="DataAccessLayer">
            DataAccessLayer\MyTemplate.vstemplate
        </ProjectTemplateLink>
    </ProjectCollection>
</TemplateContent>

我将模板复制到了[drive]:\Users\[user]\Documents\Visual Studio 2013\Templates\ProjectTemplates\文件夹.问题在于该模板未列为多项目模板

因此,我可以创建单个项目,但不能创建包含所有4个项目的解决方案.我的模板文件夹的内容看起来像

解决方案

(对于每个项目)确保".vstemplate"文件与它所在的项目具有相同的名称.

即表示层应具有PresentationLayer.vstemplate

不需要为此创建VSIX安装程序,但是该链接可以直观地表示"root.vstemplate"中的内容.

此外,完成此操作并将您的模板文件夹复制到〜/My Documents/Visual Studio 2013 \ Templates \ ProjectTemplates \后,应在创建新项目"的"Visual C#"部分中找到该选项./p>

I followed the How to: Create Multi-Project Templates article to create a template that will generate a solution containing 4 projects. My Root.vstemplate file contains the following

<VSTemplate Version="2.0.0" Type="ProjectGroup"
xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
<TemplateData>
    <Name>Yugasat BeyondAdmin</Name>
    <Description>The Yugasat BeyondAdmin Project Template</Description>
    <Icon>Icon.ico</Icon>
    <ProjectType>CSharp</ProjectType>
</TemplateData>
<TemplateContent>
    <ProjectCollection>
        <ProjectTemplateLink ProjectName="PresentationLayer">
            PresentationLayer\MyTemplate.vstemplate
        </ProjectTemplateLink>
        <ProjectTemplateLink ProjectName="BusinessLogicLayer">
            BusinessLogicLayer\MyTemplate.vstemplate
        </ProjectTemplateLink>
        <ProjectTemplateLink ProjectName="BusinessLogicLayerAPI">
            BusinessLogicLayerAPI\MyTemplate.vstemplate
        </ProjectTemplateLink>
        <ProjectTemplateLink ProjectName="DataAccessLayer">
            DataAccessLayer\MyTemplate.vstemplate
        </ProjectTemplateLink>
    </ProjectCollection>
</TemplateContent>

I copied the template to the [drive]:\Users\[user]\Documents\Visual Studio 2013\Templates\ProjectTemplates\ folder. The problem is that the template is not listed as a multi project template

So I can create the individual projects, but not a solution containing all 4 my projects. The content of my template folder looks like

解决方案

Ensure that the ".vstemplate" file (for each project) has the same name as the project that it resides in.

i.e Presentation Layer should have a PresentationLayer.vstemplate

Its not necessary to create a VSIX Installer for this but the link has a visual representation of what is expected in the "root.vstemplate".

Also, once this has been completed and your template folder has been copied to ~/My Documents/Visual Studio 2013\Templates\ProjectTemplates\, the option should be found in the "Visual C#" section of Create New Project.

这篇关于如何在Visual Studio 2013中创建多项目模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆