Modifying the VSDir File
Finally, we need to add an entry to the VSDir file. Files with a .vsdir extension are used by the Visual Studio .NET Add Item and New Project dialog boxes to determine which applets to display and their order. The VSDir file for project templates already exists in the same folder where you'll be placing the .vsz wizard launch file.
Modify the CSharpEx.vsdir file for the custom attribute project template. I chose this file because it contains the entry for CSharpDLLWiz, which is the template we used as our wizard's starting point by copying the CSharpDLLWiz folder. Listing 5 contains the complete listing for the CSharpEx.vsdir file. The last line is the entry for our wizard.
Listing 5The VSDir File
CSharpControl.vsz|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|#2324|30| #2325|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|4555| |WindowsControlLibrary CSharpDLL.vsz|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|#2322|20|#2323| {FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|4547| |ClassLibrary CSharpWebControl.vsz|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|#2347|60| #2348|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|4552| |WebControlLibrary CSharpEmpty.vsz|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|#2330|90|#2331| {FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|4549| |Project CSharpEmptyWebProj.vsz|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|#2332| 100|#2333|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|4550|1|WebProject1|web CSharpWinService.vsz|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|#2349|80| #2350|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|4556| |WindowsService CSharpImportProjectFolder.vsz|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}| #2360|110|#2361|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|4561|33|Project CSharpAttr.vsz|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|Custom Attribute Library|20|Custom Attribute Library| {FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|4547| |AttributeLibrary
We can copy and paste the entry for the CSharpDLL.vsz file as a starting point because our project template creates a similar kind of project. But we need to make some changes. Table 1 describes the cryptic pipe (|) delimited VSDir entries.
Table 1 Entries for the VSDir File
Value |
Description |
CSharpAttr.vsz |
Wizard launch file path and filename |
{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC} |
Class ID representing the C# editor factory |
Custom Attribute Library |
Localized name |
20 |
Sort priority |
Custom Attribute Library |
The text description that will appear in the New Project dialog or a resource identifier for this text |
{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC} |
Class ID or path for a DLL containing icons (we used the same one used by the Class Library) |
4547 |
Icon resource identifier (see the previous item) |
<blank> |
Flags |
AttributeLibrary |
Suggested base name (the name used as the template project's root name) |
Collectively, the steps to this point complete the project template for custom attributes. All of this information is used by the C:\Program Files\Microsoft Visual Studio .NET\Common\IDE\VsWizard.dll application.
CAUTION
Be sure to test your new project template.