Add item to Help menu RRS feed

  • Question

  • What is the easiest way to add a item to the Help menu in Visual Studio 2008 that open's a URL in a new "tab"?

    Wednesday, January 23, 2008 12:59 PM


All replies

  • This is quite simple. First you will create a macro that does it and then you'll place it in Help menu.

    1. Create the following macro:
      Code Snippet

          Sub OpenUrlInNewTab()
                  Dim url As String
                  url = "ms-help://MS.VSCC.v90/MS.MSDNQTR.v90.en/dv_vscmds/html/c6a4fbd6-8e9d-45cc-8b2f-93990d065e78.htm"
                  'enclose URL in double quotes
                  url = """" & url & """"
                  DTE.ExecuteCommand("nav", url & " /new")
                  'nav is alias for View.ShowWebBrowser command
                  'View.ShowWebBrowser URL [/new][/ext]
                  ' Optional. Specifies that the page appears in a new instance of the Web browser.
                  ' Optional. Specifies that the page appears in the default Web browser outside of the IDE.
              Catch ex As Exception
              End Try
          End Sub

      Change the url variable to your desired value. Here is a quick help how to create macro in VS.
    2. Place this macro to your Help menu. Here's the help how to do it.

    Wednesday, January 23, 2008 3:40 PM
  • Thanks! Great info!


    Only thing I would like to know now is how can I package this into  VS.NET setup project so I can put the "macro" in a .MSI installer.


    Wednesday, January 23, 2008 4:43 PM
  • Ah, that's a different story. Macros cannot be deployed. If you want to do all this on other machines, you need to create add-in. This is more complicated. Just create Add-in project in VS. It will create simple add-in which adds its own menu under Tools menu. You need to modify  the code so that it creates menu under Help. Then you add the code from the macro to the menu handler.

    See for great information about VS add-ins. Specially, see the following articles:
    HOWTO: Adding buttons, commandbars and toolbars to Visual Studio .NET from an add-in

    HOWTO: Guessing the name of a command bar to add a custom menu entry in Visual Studio .NET add-ins

    HOWTO: Removing commands and UI elements during Visual Studio .NET add-in uninstallation
    Wednesday, January 23, 2008 5:45 PM