Create Boilerplate Templates
Save time and repetitive coding by customizing the code contained in new project files you create in VS.NET.
by Jonathan Goodyear
September 2002 Issue
Technology Toolbox: C#, ASP.NET
Visual Studio .NET has many hooks you can use to customize the way it behaves. If you're frustrated by something—such as the limited boilerplate code VS.NET's New Project Item Wizard produces (see Listing 1)—there's usually a way to customize it to suit your needs. In this column, I'll show you how to customize the code VS.NET creates for files such as class libraries and ASP.NET Web Forms by stepping you through the process of creating your own project item template. You'll save yourself time, trouble, and repetitive coding, and give your future .NET projects increased standards compliance.
Each of the New Project Item Wizards has a template contained under the VS.NET file path. I'll assume you didn't modify your install path when you installed VS.NET, and that it's located at C:\Program Files\Microsoft Visual Studio .NET\. I'll call this folder the root folder. The root folder contains a subfolder for each supported .NET language that's installed. I'll show you how to create a C# template in this article, but you can mirror the instructions to create a Visual Basic .NET template as well.
Back to top
|