Share via


Guidelines for Large Command Sets

注意

Beginning with Visual Studio 2008 SDK, use XML Command Table (.vsct) files instead of command table configuration (.ctc) files to define how menus and commands appear in your VSPackages. For more information, see XML-Based Command Table Configuration (.vsct) Files.

The choice between developing a small command set for a VSPackage or a larger, more complex command set is shaped by a number of design considerations.

When to Use Large Command Sets

If you anticipate that your VSPackage will eventually have several commands appearing in multiple contexts and readability might become a problem, it is best to design your command scheme according to these guidelines. If you are new to Visual Studio and just want to see your package appear in Visual Studio, then follow Guidelines for Small Command Sets. Likewise, if you are developing a small VSPackage that may never have to accommodate complex functionality, then follow the guidelines for creating a small command set.

After you become more familiar with Visual Studio, it is better to follow these guidelines since they give you more flexibility.

Best Practices for Large Command Sets

Following is a list of tips and best practices that you can follow when you are creating large command sets:

  1. Use a header file to assign a name to each GUID and command ID.

  2. Self-parent all menus. That is, use the same GUID and command ID in both the Menu ID and Group ID fields.

  3. Self-parent all groups and commands as you did for menus in the previous step.

  4. Use entries in the CMDPLACEMENT_SECTION – CMDPLACEMENT_END section to place all commands, combo boxes, and child menus into groups.

  5. Groups that contain a single command are acceptable.

  6. Use entries in the CMDPLACEMENT_SECTION – CMDPLACEMENT_END section to populate menus with groups.

  7. Within the CMDPLACEMENT_SECTION – CMDPLACEMENT_END section of the command table configuration (.ctc) file, the entries that populate a given menu or group should be adjacent to one another. This aids readability and makes the Priority rankings easier to determine.

See Also

Concepts

Best Practices for Implementing Menu and Toolbar Commands

How VSPackages Add User Interface Elements