Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
From the author of

Copying an Existing Project Template

Select File, New, Project to open the New Project dialog box, which displays a list of project types from which you can select. (You get the greatest selection of new kinds of projects with Visual Studio .NET Enterprise Architect.) These project templates contain elements that are fundamental for the selected type of application. For example, if you select the Console Application template, you get a project that contains a class with a static main method. This static main method is the entry point for a console application.

NOTE

And here's the advantage of using project templates: You might normally have to work to discover that a console application has a static main method that uses the Single-Threaded Apartment threading model (STAThread) attribute, but the Console Application project template takes care of this detail for you.

The easiest way to create a project template is to copy an existing project template. Existing project templates are defined in folders in C:\Program Files\Microsoft Visual Studio .NET\VC#\VC#Wizards, if you use the default installation folder for Visual Studio .NET. The CSharpDLLWiz folder contains a project template close to the one that we want to create for this example, so we'll copy this project template (see Figure 1).

Figure 1Figure 1 Copy an existing project template folder that contains a project template close to the new template that you want to create.

To copy the project template, follow these steps:

  1. In Windows Explorer, copy the C:\Program Files\Microsoft Visual Studio .NET\VC#\VC#Wizards\CSharpDLLWiz folder.

  2. Paste the folder in C:\Program Files\Microsoft Visual Studio .NET\VC#\VC#Wizards. This step will create a folder named Copy of CSharpDLLWiz.

  3. Assign a new name to the copied project template folder. For this example, I used the name CSharpAttrWiz. (You can use any name you want.)

The new folder contains Scripts and Templates subfolders. These subfolders contain files that support the wizard behavior, including template files that are used to generate the source code files in each new project created from the template.

  • + Share This
  • 🔖 Save To Your Account