Guidelines for Small 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 Small Command Sets

If you are new to Visual Studio and just want to see your VSPackage appear in Visual Studio, then follow these guidelines for creating a small command set. Likewise, if you are developing a small VSPackage that may never have much functionality, then follow these guidelines for creating a small command set. If your VSPackage will eventually have many commands appearing in multiple contexts, however, and readability might be an issue, it is best to follow the Guidelines for Large Command Sets.

After you become more familiar with Visual Studio, it is better to follow the guidelines for larger command sets because it gives you more flexibility.

Best Practices for Small Command Sets

Following is a list of tips and best practices to follow when you are implementing small command sets:

  1. Prepare a chart of the command structure in advance. Identify the commands, combo boxes, command groups, and context menus that will be used in more than one location.

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

  3. Whenever possible, use the Group ID field of commands, combo boxes, groups, and child menus to place them into appropriate groups.

  4. Assign these groups to menus displayed by the VSPackage.

  5. The Group ID field of a command or child menu cannot refer directly to another menu. Assign commands and child menus to groups, which are then assigned to parent menus.

  6. After a command's definition, place the command in additional groups, as necessary, using entries in the CMDS_SECTION – CMDS_END section for each subsequent use.

  7. Within each section of the command table configuration (.ctc) file, place the lines that populate a given menu or group next to one another. This aids readability and makes the Priority rankings easier to determine.

See Also

Concepts

How VSPackages Add User Interface Elements

Best Practices for Implementing Menu and Toolbar Commands

Command Table Configuration (.Ctc) Files