给开心的:Visual Studio .NET Custom Wizards
点击次数:19 次 发布日期:2008-11-27 00:42:21 作者:源代码网
|
Note: this article is based on Visual Studio .NET Beta 2 and Windows 2000. In this article, we use the words Wizards and Templates interchangeably. Existing Projects Types and Wizards The following screen shot shows some of the project templates and wizards that are supported by Visual Studio .NET by default. When a project type and template is chosen, Visual Studio .NET creates a solution and project based on the user"s selection, and generates some files that contain the skeleton code. Some project templates, like the Class Library template, generate very simple code that contains one class and a stub for its constructor, while templates such as Visual Studio .NET Add-ins or ATL Server generate quite a few files, each containing substantial code. This generated code is usually stored in a file with placeholders for user input values, such as the class and project name. When a specific project type is chosen, Visual Studio .NET invokes a component that reads these canned (also known as templated) files, and substitutes the placeholders with the user input values. Next, this component creates the required projects and solutions using the Visual Studio .NET Extensibility model. Visual Studio .NET looks for specific files in a fixed location that contain information about the available project templates, and the components that will be responsible for creating new projects based on that template. We will cover this architecture in the next section. Visual Studio .NET Project Template Architecture Visual Studio .NET uses a component based model to support the project templates. Each project template has a corresponding component that handles requests for the given template. A single component can handle requests for multiple templates as well. Visual Studio .NET uses two types of files that are used to identify the project templates, and the components that handle requests for these project templates. The first file (identified by a .vsz extension) contains information about the component, and any custom parameters that the component handling the project template might need. The second file (identified by a .vsdir extension) contains information about the description of the project type, and display properties in the New Project dialog box. Let us now explain these two files in detail. 源代码网供稿. |
