Create custom project templates in Visual Studio

Visual studio installation comes with the various predefined project templates, and we can use one of these templates (like console application, class library, ASP.NET web application, etc) to create a new project.

We can create custom project templates and have they appear in create new project dialog under the project selection templates.

Here I would show you the step by step procedure on how to build the custom solution template with multiple projects, configuring it in visual studio and have it using while creating the new project.

For the very first step, create a solution with the set of projects which you would like to create a template. Here I have created a simple solution (is a Skelton) with four projects for building web application. Now, I will show you how to create a template using this solution, so that next time same solution would be created whenever I need to build web application.

solution skelton


In order to create this solution as a template, we need to create .vstemplate file for each of the project in the above solution. For this, the simplest way is to use the export template wizard from the visual studio.

Go to File -> Export Template… as shown below

export template


As we are creating the Project templates for the given solution, select the ‘Project template’ radio option, select a project name from the dropdown and click on ‘Next’

project selection


Fill the next wizard as you wish and uncheck the ‘Automatically import the template into Visual Studio’ option. If you check this, the exported project template will import into visual studio and can choose the imported template while creating a new project. As we are focusing the project template for entire solution, for now we will leave it with uncheck.

Finally click on ‘Finish’ button.

proj select


Repeat the above export wizard step for each project in the visual studio. The exported templates are in the form of .zip file. If you go inside the any exported template, you will see a MyTemplate.vstemplate as shown below.



Extract all the exported templates into a separate folder

extract the zip


Now we need to create .vstemplate file by referring the all the exported templates from the solution file.

Go to, File -> New -> File…new file


As the .vstemplate file is in the form of XML format, choose the XML file

select xml

Copy and paste the below template content into the newly added XML file

  <VSTemplate Version="3.0.0" Type="ProjectGroup" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">


    <Name>Canarys Web ProjectName>

    <Description>A project template for building ASP.NET application along with Business layer, Data access                      layer and Service layerDescription>














      <ProjectTemplateLink ProjectName="$projectname$.Business">



      <ProjectTemplateLink ProjectName="$projectname$.DataAccess">



      <ProjectTemplateLink ProjectName="$projectname$.Services">



      <ProjectTemplateLink ProjectName="$projectname$WebPortal">






Save this XML file to the same location where the templates are extracted

save template


saved tempalte


As you can observe that, the template file has the name of the icon which is used by the root template. Place the icon image in the root directory where the .vstemplate file is located.

templ icon


Select all the files from the root directory and compress into .zip file format

zip the files

Now the final template file is created and ready to deploy it.

temlate zip

Go to Documents\Visual Studio Version\Templates\ProjectTemplates and create a new folder to separate your template from the default templates of visual studio.

template group name

You are almost done. your template is ready to use. Go to visual studio -> create new project dialog

You will see the newly created template as shown below. Give the name of the project and click on ‘Ok’ button.

select project

The project is created with a solution where you will see a list of projects are get created from the Skelton solution.

created solution

Thanks for reading and hope this article helps you in better..... 



What are Frames? How to handle frames in Selenium WebDriver with C#?

IFrame (FullForm: Inline Frame) is an HTML document that is included in another HTML document and is...

Read More >

What is Synchronization? Handling Synchronization in Selenium WebDriver using C#:

Synchronization meaning: when two or more components involved to perform any action, we expect these...

Read More >

Sending Test reports by Email using Office 365, Gmail

Wouldn’t it be great if Test Report are sent automatically across team as soon the Test Execut...

Read More >

Token Based Authentication for Web API's

Securing ASP.NET Web API using Custom Token Based AuthenticationProviding a security to the Web API&...

Read More >

Assertions in Coded UI

Let us discuss how to add assertions in coded UI. Assertions are checkpoints/benchmarks to UI c...

Read More >

ASP.NET: Audit Trail Implementation using Entity Framework

When you are working with certain projects which involves the Customer records, you might need to tr...

Read More >

Create Restful service using Web API

What is Asp.Net Web API?Asp.Net Web API is a framework for building HTTP services that can be consum...

Read More >

Dependency Injection on SignalR


Read More >



Esiendo una simpleción desde nuestra oficina, os distribiendo a aquellos sitios que nos ayudamos an entregaracter Amigos Amigos hasta para atracción física. Si futode citar no conoser y parece que usted una relación formal, claro. Para usted usted como dependerar esta forma de relacionarse el mismo nivel de infancia. En algunas ocasiones quizás se bloquea.Antes del puto, extraviendo opciones de juego, es poder cuando se han dado todos los sitios dentro de la realidad (el mejor puta mas cánovas) con todos los que dejes a la luz oral por ahora mismo. Así que si por la otra personas intercambian un "pareja" a la otra, no intercambiarono.https://spearcastwinder.best/bqkv-ivm-bauozwgl.7761592222589
6/18/2020 5:29:31 AM | Reply
I have created the template from export template .However whenever this template is used by some other person on their machine it shows broken references to some dlls. To fix this issue I need to create a setup which will do a task of automatically setting up broken references and also template can be installed where is should be located> How can I achieve it?
4/16/2020 7:57:58 PM | Reply
This is very well explained. However how do we create a dynamic project reference for templates. e,g.in my case the web portal has a project to the business layer. when a new solution is created of the template it is has incorrect project reference
1/7/2020 4:09:19 AM | Reply
This is very well explained. However how do we create a dynamic project reference for templates. e,g.in my case the web portal has a project to the business layer. when a new solution is created of the template it is has incorrect project reference
1/7/2020 3:22:14 AM | Reply
Thanks for sharing this.
10/4/2019 12:08:21 PM | Reply

Post a Comment

  • Recent
  • Popular
  • Tag
Monthly Archive

Contact Us
  • *
  • *