How to create a multi project template in visual s

2019-03-29 22:40发布

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

enter image description here

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

enter image description here

1条回答
贼婆χ
2楼-- · 2019-03-29 23:16

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.

查看更多
登录 后发表回答