Enterprise Templates for VS.NET 2003 Professional
I'm currently working on a project that requires a number of very similar project be built. Since I really despise repetitiveness, I looked into creating a creating a project template that would appear in the "New Project" dialog. After a quick Google search, I found a blog entry by Ryan LaNeve that addressed the problem. Because the solution is not a difficult one, it is much more likely that you would use it. Note that my example is specific to C#, though this could just as easily be applied to VB or C++.
Restart Visual Studio and open a new project. Your custom project should appear.
You might also want to check out the following entry by Michael Weinhardt.
Adding Custom VB.NET Project Item Template Wizards to VS.NET by Michael Weinhardt
- First you'll want to create
a new project that will act as the basis of your template. - Next, edit the
<Microsoft Visual Studio .NET 2003 installation
directory>\VC#\CSharpProjects\CSharp.vsdir. Copy any one of the lines
already appearing in the file and then paste it at the bottom. I would recommend
copying the line that references the project that is the base of the project
template you are trying to create. The line looks something like the
following: <*.vsz file name>|<GUID - leave this
alone>|<Project Name>|<Sort Priority>|<Project
Description>|<GUID - leave this alone>|<Icon Resource ID -
leave this alone>| <Flags (probably blank) - leave this alone>
|<Suggested Base Name>. Make changes as necessary. - Now copy one of the *.vsz
files in the same directory and rename it using the name you entered for the
first parameter in the step described above. - Open your new *.vsz file
and change "WIZARD_NAME" parameter to a unique folder name. The line
you are changing should look like " Param="WIZARD_NAME = <foldername>"
". Take note of the foldername. - now go to the
<Microsoft Visual Studio .NET 2003 installation
directory>\VC#\VC#Wizards directory and copy and paste one of the
subfolders. Rename it using the foldername you entered in Step 4. Delete all
files in the Templates\1033 subdirectory except the
templates.inf file. - Now for the stuff that isnt
so "cookie-cutter". Locate all of the files in your base class except
project files and solution files. You would probably be interested in files with
the following extensions: .cs, .aspx, .asax, etc. This is by no means an
exhaustive list. Copy them to the Templates\1033 subdirectory located
in the directory you created in Step5. - Open the templates.inf
file, remove the current entries and then list all of the files that you copied
from the base directory in Step 6. - Open up each of the files
now listed in the templates.inf directory and locate the Namespace. Replace
it with "[!output SAFE_NAMESPACE_NAME]". Do this for every reference to
the original Namespace. - If your project template is
just a minor revision of an existing template, you really don't have to go
beyond this step. But what if you have added references or pre- and/or
post-build events? You'll have to copy your original *.csproj file to the
<Microsoft Visual Studio .NET 2003 installation
directory>\VC#\VC#Wizards directory. - Open your new *.csproj file
in notepad and take a look. You will probably need to delete a good portion
of the contents of this file, though this may not be the case. The best way to
tell you how to edit this is to open up one of the other *.csproj files and try
to make your file look similar. Remove all that is unnecessary. You will have to
delete any files referenced in the <Files> section otherwise you
will get errors. Visual Studio will automically add the files you copied in
Step6.
Restart Visual Studio and open a new project. Your custom project should appear.
You might also want to check out the following entry by Michael Weinhardt.
Adding Custom VB.NET Project Item Template Wizards to VS.NET by Michael Weinhardt





