Click here to Skip to main content
13,700,115 members
Click here to Skip to main content
Add your own
alternative version


39 bookmarked
Posted 28 May 2004

Add a custom template to Visual Studio .NET 2003

, 28 May 2004
Rate this:
Please Sign up or sign in to vote.
An article that explains a method to add your own custom template in the Visual Studio .NET 2003 IDE.

Sample Image


I have always wondered if there is a way to change or rather remove the default contents of the 'New Item' presented by VS.NET 2003 IDE, when I create a new file for my Microsoft .NET project. I knew that it should be somehow possible to do it, but will it take me to install a new plug-in or make more of Google to do it.

I tried to check some sources for this purpose and resulted myself in experimenting with the information in the Visual Studio .NET 2003 Help Documentation. All the information given here are from my understanding on the information present in the Visual Studio .NET 2003 Help Documentation.

Note: the attached files are just sample files and are not source files as you may find in other articles.

Background for the article

This article's contents are written after I went through the contents in Visual Studio .NET 2003 Help Documentation.

Template Creation Process

As an ASP.NET developer, for this article, I would be focusing on the template for 'WebForm' using Visual Basic .NET.

I hereby assume that the visitor to this article would have a good idea on how to create and use a Project using Visual Basic .NET in Visual Studio .NET 2003 IDE. You can create a new WebForm for your web project from the Visual Studio .NET 2003 by:

File --> Add --> Add New Item (select the ‘WebForm’ there)

The default 'aspx' page generated by Visual Studio .NET 2003 would be as follows:

<%@ Page Language="vb" AutoEventWireup="false" 

    Codebehind="WebForm2.aspx.vb" Inherits="TestWeb.WebForm2"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
    <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
    <meta name=vs_defaultClientScript content="JavaScript">
    <meta name=vs_targetSchema 

  <body MS_POSITIONING="GridLayout">

    <form id="Form1" method="post" runat="server">


I wanted the above code to be generated as follows:

<%@ Page Language="vb" AutoEventWireup="false" 

  Codebehind="TemplateWebForm2.aspx.vb" Inherits="TestWeb.TemplateWebForm2"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
        <title>My Template</title>
        <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
        <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
        <meta name="vs_defaultClientScript" content="JavaScript">
        <meta name="vs_targetSchema" 

        <meta name="Author" content="Saravana Kumar S P">
        <meta name="Author Mail" content="">
    All sorts of stuffs that I want to put here
        <form id="Form1" method="post" runat="server">

There are two ways to play around with this.

  1. Replace the template - change the default content of the WebForm from Visual Studio .NET 2003’s content to the required format.
  2. Create a new template - create with the different content for the WebForm, and allow it to be selected from the screen, when creating a ‘New Item’.

We will see both of them in this article. Although I am most interested in the second option.

Option 1: Replace the template.

This is as good as a piece of a cake.

  1. Open the following directory:
    C:\Program Files\Microsoft Visual Studio .NET 2003\
  2. The above folder is self explanatory. It is in the Visual Studio .NET 2003 installation folder, and I have chosen the WebForm in the VBWizards, that is in the VB language folder for VS .NET 2003. In this folder, we have one file WebForm.aspx.
  3. This is the template file we are talking about. Now, open the file and modify the contents and save it back.
  4. Yes, we got the job done.
  5. Now, open a Web Project in VB.NET, in your Visual Studio .NET 2003 IDE.
  6. Create a new WebForm for the project. Here, you will get the contents from the file you had just edited.

Option 2: Create a new template.

Note: sample files in this article correspond to this method.

This is something I was looking for days, and oops, finally got it from the Visual Studio .NET 2003 Help Documentation. To do this, close the Visual Studio .NET 2003 IDE and follow these steps in the given order:

  1. Locate the following folder:
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vb7\VBWizards
  2. Copy the folder WebForm into a new name as TemplateWebForm.
  3. Now locate this new path:
    C:\Program Files\Microsoft Visual Studio .NET 2003\
  4. Rename the file WebForm.aspx to TemplateWebForm.aspx.
  5. This file is going to be the new template. So, change the contents of this file TemplateWebForm.aspx. You can come back and change the contents later too.
  6. Locate the file default.js in one of the new folders created just now:
    C:\Program Files\Microsoft Visual Studio .NET 2003\
  7. In line #16, change the “WebForm.aspx” to “TemplateWebForm.aspx”.
  8. Save and close the file, you may not need to edit this file anymore.
  9. Now go to this folder:
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vb7\VBProjectItems
  10. Copy the file WebForm.vsz as a new file and name it as TemplateWebForm.vsz.
  11. In line #3, change the WebForm to TemplateWebForm.
  12. Save and close the file.
  13. Go in to the directory Web Project Items and create a new file and name it as UserProjectItems.vsdir (you will have to maintain the extension of the file as it is given above).
  14. Put the following line of code there:
      My Template|10|A user-created web form for CP|
  15. Now, fire up the Visual Studio .NET 2003 IDE, and open / create your web project.
  16. Add a NEW ITEM, and the link for the template is listed there as ‘My Template’.
  17. Select it and play around with it.

To Do’s for this article:

  1. The template is listed in the top level root of ‘Web Project Items’ only. This can also be made available in the respective folders also – ‘UI’ in this case.
  2. Show the ‘Add My Template’ in the menu ‘Add’, that appears when you right click the Web Project in the Solution explorer.


To be updated whenever I find that I have something new to be told about this article!


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Sarvesvara (BVKS) Dasa
Team Leader Emirates Group IT (Emirates Airline)
United Arab Emirates United Arab Emirates
Saravana Kumar lives in the commercial hub of Dubai.

He started programming when he was 14 with FORTRAN in the DOS based PCs. He developed himself with the evolution of Windows 3.1, 95, 98, 2000, XP, Vista... along with the programming languages and tools like C, BASIC, C++, JAVA, DBASE 3+ etc.

He completed his Engineering Graduation in Computer Science in the year 2000 and started his career into software by programming into the microprocessor. C, DSP were his stepping stone as a Software Programmer, in Madras, India.

He changed career by taking a big leap in switching himself (also relocating to Dubai, UAE) to Web Sites and stuffs. He was playing with HTML, ASP, and Java Script for a while.

He got himself a break in his career for a few months and got a dip into the .NET. He then became a .NET programmer (basically into ASP.NET) in Dubai Technologies, Dubai, UAE. Then circumstances forced him to take a break and came back to Dubai. He is working as a Software engineer. He enjoys his work, right now, fully occupied, but still finds time to spare at the Code Project.

He enjoys playing games like solitaire, commandos. He likes music a lot. He loves to be alone most of the time (as a Piscean - a day dreamer). He is happy that he is the first person in his family to 'work' than involve in the business. He is sad that he is not able to keep in touch with his friends and loved ones. But in a way happy that he still remembers them.

Saravana Kumar got a new PDA (iMate PDA2k) March 2005, and spends quality time with it. Still not tired of downloading the software and not tired of the upgrades for the device.

Update: Saravana Kumar is a 'Contributing Editor' for PocketPCDubai website, writing reviews and posting news/messages relating to PocketPC.

His mobile usage increased a lot and the list is,

Nokia 3330
iMate PDA2k
HP iPAQ HW 6515
Everex ETEN G500
iMate PDA-n
(more to come...)

You may also be interested in...

Comments and Discussions

Generalnice Pin
Pranay Rana23-Dec-10 1:01
memberPranay Rana23-Dec-10 1:01 
QuestionUsing a web html template in asp? Pin
Tarun.Suneja24-Sep-08 7:24
memberTarun.Suneja24-Sep-08 7:24 
QuestionIn VS 2005, how do you change the template used when a master page is selected? Pin
jsneeringer27-May-07 16:02
memberjsneeringer27-May-07 16:02 
GeneralChange Icon Pin
rramirezc29-Apr-05 22:15
sussrramirezc29-Apr-05 22:15 
GeneralChange Icon Pin
gchmex29-Apr-05 22:12
membergchmex29-Apr-05 22:12 
Generalneed details, plz Pin
Andrew Tihiy3-Mar-05 7:21
memberAndrew Tihiy3-Mar-05 7:21 
GeneralGreat!, and also Pin
Philip Fitzsimons2-Jun-04 0:45
memberPhilip Fitzsimons2-Jun-04 0:45 
GeneralRe: Great!, and also Pin
S P S2-Jun-04 4:28
memberS P S2-Jun-04 4:28 
GeneralRe: Great!, and also Pin
barsju15-Jul-04 22:38
memberbarsju15-Jul-04 22:38 
GeneralRe: Great!, and also Pin
S P S15-Jul-04 23:59
memberS P S15-Jul-04 23:59 
GeneralRe: Great!, and also Pin
Jeremy Rosenberg30-Sep-04 9:56
memberJeremy Rosenberg30-Sep-04 9:56 
GeneralRe: Great!, and also Pin
Ashley van Gerven10-Nov-04 18:00
memberAshley van Gerven10-Nov-04 18:00 
GeneralGood one! Pin
Mr.Prakash30-May-04 6:20
memberMr.Prakash30-May-04 6:20 
GeneralRe: Good one! Pin
S P S2-Jun-04 4:23
memberS P S2-Jun-04 4:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web01-2016 | 2.8.180910.1 | Last Updated 29 May 2004
Article Copyright 2004 by Sarvesvara (BVKS) Dasa
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid