Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a multi project template in visual studio 2013?

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

like image 502
Andre Lombaard Avatar asked Dec 09 '14 10:12

Andre Lombaard


1 Answers

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.

like image 89
Jacques Olivier Avatar answered Nov 14 '22 08:11

Jacques Olivier