Custom Visual Studio Solution Template with Subfolders

Creating a project template in Visual Studio can save a bunch of time if you are planning on creating a bunch of similar projects.  I have chosen to build a series of projects that resemble Microservice architecture I am calling Service Stacks.  Creating Visual Studio solution templates seems like one of those things that is so easy there isn’t much documentation or many tutorials to help you do it. Elizabeth Andrews has a nice post that helped me take the initial step beyond a single project template to creating solution templates that contain several projects.

One of the first things I wanted to do is organize the projects into solution folders.  I have seen other solution templates that divide projects into subfolders named things like Web, Backend, Winforms.  The way you do this is in the <ProjectCollection> section you simply wrap the <ProjectTemplateLink> tags in a <SolutionFolder> tag like this:

<TemplateContent> 
    <ProjectCollection> 
        <SolutionFolder Name="My Folder"> 

            <ProjectTemplateLink>             
ProjectName="$safesolutionname$.Domain"> Domain\Domain.vstemplate 
            </ProjectTemplateLink>

        </SolutionFolder> 
    </ProjectCollection> 
</TemplateContent>

This results in the solution containing a folder called “My Folder” that contains the project “Domain”.  Give it a try and let me know if it works for you.

Advertisements
Custom Visual Studio Solution Template with Subfolders

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s