views:

454

answers:

3

In Visual Studio version 2002 and 2003 "Go To Definition" would find the selected type or member in the Object Browser. In 2005 onwards it opens a source window "generated from metadata" instead. How do I configure these newer versions to go to Object Browser? (In other words, I have the opposite problem to this one.)

Installing ReSharper makes this change, so I know it must be possible, but how do I do it without ReSharper?

+7  A: 

As workaround you can create the following macro:

Sub GoToDefinitionUsingObjectBrowser()
    DTE.ExecuteCommand("Edit.SelectCurrentWord")
    DTE.ExecuteCommand("View.ObjectBrowser")
    DTE.ExecuteCommand("View.ObjectBrowserSearch", DTE.ActiveDocument.Selection.Text)
End Sub

Then go to Tools/Options/Keyboard and assign hot key for this macro.

Tested in Visual Studio 2010.

Jarlaxle
-1: I have already done this years ago. Yet, this method does not address the issue of using "Go To Definition" from the context menu, the command window, or from other places within the IDE. That is why I added the bounty. To get a definitive answer. Not work arounds.
AMissico
You downvoted the solution. Modify the context menu.
Hans Passant
+3  A: 

I believe what re-sharper is doing is doing some hooks on that click event with the Visual Studio SDK I do not think there is any simple menu or location that can change that setting.


Instructions (pulled from CODE Magazine) edited down a bit to the part that pertainst to making the right click menus.

Creating a VSPackage

...The VS SDK installs a few more project templates in Visual Studio, one of them being the Visual Studio Integration Package (Figure 1), located under Other Project Types > Extensibility on the New Project dialog box.

After this standard dialog box, the Visual Studio Integration Package Wizard guides you through creating the new package project:

  1. Select a programming language. The wizard currently supports Visual C++ and Visual C#. You can create or pick a key file to sign the new package.
  2. Supply basic VSPackage information. The wizard prompts you for details such as the company name, VSPackage name, version, icon, detailed information, and minimum Visual Studio edition (such as Professional or Enterprise) that the package is designed to at this step. This information goes into the Visual Studio splash screen and About dialog box and is also used to request a PLK for the package (covered later).
  3. Select VSPackage options. A package may add three types of functionality: Menu Command, Tool Window, and Custom Editor.

A menu command is a command added either to the menu at the top of Visual Studio or to a context menu (right-click).

When the wizard finishes its job, the VS SDK adds core elements to the solution to support the new package. For instance, if you selected Tool Window as part of the functionality for the package, the project contains a user control where you should place the visual controls for the window. The project also contains files for .NET code to handle the functionality that you will add to the package.

A CtcComponents folder contains pseudo-C++ files (ctc files) where you define things like menu, groups, buttons, etc. Fortunately, Microsoft is phasing out CTC files and replacing them with a friendlier, XML-based VSCT file format (which will ship in the SDK for Visual Studio 2008).

The wizard creates a few other files with .NET code required for the plumbing of the package within Visual Studio. Some of these files contain classes that map the C++ constants to .NET constants and other files contain configuration information for the package when it’s installed.

Scott Chamberlain
Yes, that is my assumption also. I was hoping for a more specific answer, specifically an add-in or a macro.
AMissico
A: 

Use VB.NET. :-)

Mark Hurd
I have been for years and years. I am currently working with C# and will be for many months to come, so redirecting to the "Object Browser" is important.
AMissico