Speed Up with Project Templates Using Visual Studio 2005 - Part 2
page 5 of 9
by Ameet Phadnis
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 44562/ 91

Creating an Project Template

In my previous article I have explained how to create templates in VS 2003.  Many users might have noticed it required too much work and the developer also needed to know how all different files come together and how to use JavaScript to create the project.  Now the developers can relax since in VS 2005 it takes only 5 steps to create a template.

Steps to create Project Templates in VS 2005

·         Start with a pre-defined template.

·         Make your changes, like adding forms, classes, etc.

·         Save the Project.

·         Click File -> Export Template Option.

·         The Wizard will walk you through creating the Project Template.

Please note: Some users might not see the Export Template option in their File Menu.  You might need to add that option by following these steps.

·         Right Click on the toolbar and select Customize.

·         Click on the Commands tab.

·         Under Categories, select File.

·         Under Commands Select Export Template and drag the command under File Menu.

To demo the project template creation, I have created a website called templatearticle.  The folder structure looks like the following.

Figure 2

To create the Project Template from the above structure, follow these steps.

·         Click File -> Export Templates.

·         The Export Template Wizard displays the below figure.

Figure 3

·         Choose Template Type Step has the following options.

·         The Project dropdown will display all the projects currently in the solution.  In this example we just have one project.  So, only that project is displayed in the dropdown.

·         For Language it will display all the different language options available.  In our case it should display Visual C#, Visual Basic and Visual J#.  I will select Visual Basic for this example, but in normal cases you would select both Visual Basic and Visual C#.

·         If you wanted to export an item, you would select the Item Template option.  This option is explained in the next section.

·         Click Next.

·         The Select Template Options step displays the following.

Figure 4

·         The options for this step are the following.

·         Template Icon - You can select the image you want to display with your template in the new Project dialog box.

·         Template Name - This is the name that will be displayed in the New Project dialog box.  For this example I have entered Template Article

·         Template Description - This will be displayed as description on the New Project dialog box.

·         Automatically import the template into Visual Studio - This option will store the template in the directory you have selected in your options dialog box (explained earlier).  If you uncheck this option then it will store the template on the directory, shown above in the image. Once the template is created you can simply copy the template to the folder from where your templates are being picked for display.

·         Display an explorer window on the output files folder - This option will display the folder in explorer window where the zip file for the template is stored.

·         Click Finish.

·         Based on the options you have selected, the template that will be created.  It will also display the folder in explorer window if you have selected the option of explorer window on the output files folder.

·         If you check your templates folder, the above options will create a zip file.  If you look inside the zip file, now you will see a vstemplate file.  You can open the vstemplate file and see all the options exported while creating this template.  Also, please note that the zip file contains one extra file called _TemplateIcon.ico.  This Icon will be used in the New Project / Item dialog box.

View Entire Article

User Comments

Title: Urgent requirement   
Name: Arijit chakraborty
Date: 2009-02-18 12:36:19 AM
dear Ameet,

I am a final year B.Tech student on a project of Online Examination System(ASP.Net).We r facing very problem when we r trying 2 import downloaded templates in our project.

If u kindly help us 2 do so,it will b great for us.Hope 2 hear u soon.

Arijit Chakraborty
Title: Thank you, Thank you, Thank you!!!   
Name: Dave
Date: 2008-06-13 3:38:31 PM
Thank you for taking the time to put this information together. This info is exactly what I needed and I didn't have to figure it out from piecing together tidbits of information spread across multiple poorly linked MS documentation and kb articles. Your efforts on this article are greatly appreciated!
Title: Location field missing in templates   
Name: Cheryl
Date: 2008-04-06 10:59:03 PM
Help!!! Like Jai, the location field is hidden on all my pre-existing templates. How does this happen and how do I fix it?


Title: Thanks, it helps   
Name: elena
Date: 2007-08-01 8:20:28 PM
Thanks for the tutorial, it expalined very well, though I am looking to create template for solution with few projects. Initially I read microsoft article and it was crap. Yours - great.
Title: Great Tutorial!   
Name: Ashley
Date: 2007-07-16 5:34:52 PM
You're tutorial was very helpful! The "Personal Web Site Starter Kit" option was a nice find! I've always developed my sites from scratch! Very nicely written!

Thank you!
Title: My Export Wizard is grayed out   
Name: Dannyhut
Date: 2007-06-26 6:52:13 PM

I have created a template but when I select the File Menu, my Export Wizard Menu Item is there but is grayed out and I can not select it. Please can any one help.

Title: Customizing the project template   
Name: AP
Date: 2007-06-20 5:33:07 PM
Check this article and it should help you out http://aspalliance.com/1001_Speed_Up_with_Project_Templates_Using_Visual_Studio_2005__Part_3
Title: Customizing the project template   
Name: Moupiya
Date: 2007-06-20 1:22:00 AM
HI Ameet
Nice article.It ehlped me to know many things.I have a query.I created a project template.Now i want when the user selects my project template then he is asked for whats all things he wants to select from the project template.
Like while i created the template project i added different folders.But the user may/may not need all the things.So when he selects my project template he is asked for the options
Thanks in advance
Title: Thank you   
Name: DKB
Date: 2007-01-26 8:12:13 PM
Thankyou for all your efforts in giving us this project to use. Is there somwhere in this site that helps with design of a web template know that would compliment these instructions just great
Title: Doubt   
Name: Thiyagarajan.N
Date: 2006-12-11 11:45:30 PM
Hi, I have a doubt while create the Project template.I want to create a Project template for 3-Tier web application in a single template.It should contains one Presentation layer,BLL and DAL of solutions. How can i do that?

Title: Missing Templates Problem   
Name: AS
Date: 2006-11-15 8:51:30 AM
Well, this seems to be a known "hairy" problem. I have not found a solution to my problem just yet, but at least I know that it is a problem and some people have tried to solve it. I hope this link helps if you are experiencing it:

Title: Still have a question   
Name: AS
Date: 2006-11-15 8:38:48 AM
Good article, thanks!

I have tried the steps that you mention.
However, when I go to create a new project I do not see the template that I just created. I can see the zip file that was created, but I do not see the specific template that I just created. I also tried re-setting, as suggested by Mike before, but it does not work. Any suggestions? I'd like to use templates to work with C# Windows applications - not web apps. Thank you again for your time!
Title: Thank you buddy   
Name: Murat YILMAZ
Date: 2006-11-07 2:41:04 AM
Thank you buddy for your article.
Title: Edit item template   
Name: Firoz
Date: 2006-10-06 4:36:28 AM
A very good explanation of templates. Thanks.

One question though, can one edit an existing item (or project) template?
Title: very helpful   
Name: Amanda
Date: 2006-10-05 3:54:56 PM
Your article answered all of my questions and then some that I hadn't even thought of asking - thanks!
Title: Thank You!   
Name: Jeffrey
Date: 2006-09-29 11:52:12 AM
Thank you so much for this article and the way it was written. As a fairly new user, I was totally lost on the use of templates until I read your article. Few if any of the books that I have purchased ever even discussed templates. Thank uou once again.
Title: My Templates? (Got it!)   
Name: S10
Date: 2006-09-27 11:04:37 AM
The templates are under the Visual Basic root node in the New Project selection UI. I was looking under Windows and Starter kits and Other Project Types!
Title: My Templates?   
Name: S10
Date: 2006-09-27 10:49:48 AM
I've created a template for a DLL project instead of a Web Site. The Zip file has been created and is placed in the same directory as referred to by the Tools -> Options -> General -> User templates location directory.

However when I create a new project and use the newly created template, I do not seem to be given the "My Templates" bit of the UI! I've tried going into "Other Project Types"->Visual studio solutions as well, but the "My Templates" doesn't appear.

I've used VB.net to create the template. Does this matter?
Title: Export Template option   
Name: Ameet
Date: 2006-09-16 2:43:09 PM
Follow these steps. Its taken from the article itself

Please note: Some users might not see the Export Template option in their File Menu. You might need to add that option by following these steps.

· Right Click on the toolbar and select Customize.

· Click on the Commands tab.

· Under Categories, select File.

· Under Commands Select Export Template and drag the command under File Menu.
Title: Reset Import and Export Settings   
Name: Mike
Date: 2006-09-16 9:23:30 AM
If your Export Template Option is not visible, I just made if visible by Resetting all settings in the Import and Export Settings Wizard.
Tools->Import and Export Settings ->Reset all Settings
I can see the option now!
Title: Click File -> Export Templates   
Name: Mike
Date: 2006-09-16 8:37:24 AM
Any hint on how to make the Export Template option visible?
I'm using VS 2005 Professional.
Title: Gud   
Name: MZH
Date: 2006-08-29 1:44:52 AM
Very Very gud
Title: Excellent   
Name: Harry K
Date: 2006-08-19 11:20:39 AM
Now I know how to create a project and item template of my own. Many thanks for the concise step by step illustration.
Title: Location Field   
Name: Jai
Date: 2006-08-18 12:48:05 PM
when i created a project template and tried to use it the location field was hidden and i couldnt create my site at a different location, could you help me as to why it happens.

its a great time saver to work new projects this way.

Title: Well put together...   
Name: Yogesh R
Date: 2006-08-18 10:47:22 AM
your article is well put together. Since create best practices and templates are prone to change as we identify new standards and requirements, is there a way to change an existing custom template or Do we just need to create new projects from existing templates and create new templates from them?
Title: Thanks   
Name: AD
Date: 2006-08-07 8:34:41 AM
Very useful -- many thanks for the information.
Title: Nice!   
Name: Tony A
Date: 2006-08-05 11:42:51 AM
Nice article Ameet: Well and concisely written together with good illustrations: A great help:

Thanks and keep up the good work:


Tony A

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2023 ASPAlliance.com  |  Page Processed at 2023-10-02 7:21:51 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search