共用方式為


Extend menus and commands

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Commands are the way you add actions and processes to Visual Studio. In most cases commands are displayed on menus or toolbars. The VSPackage project template shows how to implement a very basic command. For a slightly longer but still basic implementation, see Create an extension with a menu command.

For more information about Visual Studio commands, menus, and toolbars, see Commands, menus, and toolbars.

Commands, menus, and toolbars are defined in the .vsct file that is part of VSPackage projects. You can find information about the Visual Studio IDE and the .vsct file in How VSPackages add user interface elements.

The following topics explain how to add different kinds of commands, menus, and toolbars.

In this section