July 1, 2010

Editing Context Menus of Visual Studio 2008

Can add external tools to context menu.
  1. Create your external tool using the "Tools=>External Tools" menu option. Your new external tool will be called "External Command n" where 'n' is the external menu item tool location in the external menu items group of the Tools menu
  2. Open "Tools=>Customize" dialog.
  3. Select "Context Menus" in the "Toolbars" tab.
  4. The context menus will appear on the toolbar. Select a context menu from one on the toolbar. Some useful ones are:
    • "Project and Solution Context Menus=>Item" - This is the file context menu in the solutions folder
    • "Project and Solution Context Menus=>Project" - This is the project context menu in the solutions folder
    • "Other Context Menus=>Easy MDI Document Window" - Not obvious. This is the context menu for the tab at the top of a file editor window
  5. Goto "Command" tab and select "Tools" in the categories tab. From the "Commands:" list select the appropriate "External Command n"
Perforce menu items are defined in "External Tools" as follows:
Title: P4 Checkout
Command: C:\Program Files (x86)\Perforce\p4.exe
Arguments: edit $(ItemPath)
Initial Directory: $(ItemDir)
Select "Use Output window"
As shown here:

Title: P4 Revert
Command: C:\Program Files (x86)\Perforce\p4.exe
Arguments: revert $(ItemPath)
Initial Directory: $(ItemDir)
Select "Use Output window"

No comments: