Create a MVC 3 web solution template – Part 2, Create VS template and grouping projects

From part 1, I have talked about my project template structure. Now I want to talk about how do I create the VS templates and group them into one solution.

Visual Studio only allow you to create a template from one single project. So we need to write some vstemplate scripts to group our projects all together into one solution. And save the below script as “Template.vstemplate”.

<VSTemplate Version="3.0.0" xmlns="" Type="ProjectGroup">
 <Name>Web MVC 3 Template</Name>
 <Description>MVC 3 web application template</Description>
 <ProjectTemplateLink ProjectName="$safeprojectname$.Business">
 <ProjectTemplateLink ProjectName="$safeprojectname$.Web">
 <ProjectTemplateLink ProjectName="$safeprojectname$.Data">


If you use “Export Template” wizard from VS, export all projects from your solution, and unzip them into one folder.


In my example I have three projects, Data, Business and Web. Here is the folder structure.


Now zip all the files and folders into one single package. Put it into your Visual Studio template folder.

{Documents}\Visual Studio 2010\Templates\ProjectTemplates

Or change your template location to your folder. Open VS -> Tools -> Options -> projects and solutions


Now if you open VS and create a new project, you can find the template under C# projects.


Download the sample vstemplate from

Leave a Reply

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

You are commenting using your 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