Condividi tramite


Contributing to the Add New Item Dialog Box

A project subtype can provide a complete new directory of items for the Add New Item dialog box by registering Add Item templates under the Projects registry subkey.

Registering Add New Item Templates

This section is located under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Projects in the registry. The registry entries below assume a Visual Studio project aggregated by a hypothetical project subtype. The entries for the Visual Studio project are listed below.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Projects\{F184B08F-C81C-45F6-A57F-5ABD9991F28F}]
@="#2143"
"DefaultProjectExtension"="vbproj"
"PossibleProjectExtensions"="vbproj;vbp"
"ProjectTemplatesDir"="visualStudioInstallPath\\Vb\\.\\VBProjects"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Projects\{F184B08F-C81C-45F6-A57F-5ABD9991F28F}\AddItemTemplates\TemplateDirs\{12345678-1234-1234-1122334455667788}\/1]
@="#100"
"TemplatesDir"="projectSubTypeTemplatesDir\\VBProjectItems"

The AddItemTemplates\TemplateDirs subkey contains registry entries with the path to the directory where items made available in the Add New Item dialog box are placed.

The environment automatically loads all of the AddItemTemplates data under the Projects registry subkey. This can include the data for base project implementations as well as the data for specific project subtype types. Each project subtype is identified by a project type GUID. The project subtype can specify that an alternate set of Add Item templates should be used for a particular flavored project instance by supporting the VSHPROPID_ AddItemTemplatesGuid enumeration from __VSHPROPID2 in GetProperty implementation to return the GUID value of the project subtype. If VSHPROPID_AddItemTemplatesGuid property is not specified, the base project GUID is used.

You can filter items in the Add New Item dialog box by implementing the IVsFilterAddProjectItemDlg interface on the project subtype aggregator object. For example, a project subtype that implements a database project by aggregating a Visual Studio project, can filter the Visual Studio specific items from the Add New Item dialog box by implementing filtering, and in turn, can add database project specific items by supporting VSHPROPID_ AddItemTemplatesGuid in GetProperty. For more information on filtering and adding items to the Add New Item dialog box, see Adding Items to the Add New Item Dialog Boxes.

See Also

Reference

IVsFilterAddProjectItemDlg2

Concepts

CATIDs for Objects That Are Typically Used to Extend Projects