I finally got tired of having to hunt around for methods and properties in a large VS2005 solution and wrote an add-in to help out. The add-in allows you to type in a portion of a class, method, or property name, and then navigate directly to that file. In the case of a method or property, it also navigates you directly to that point in the code. You can download the installer here and the source code here. After you run the installer, load a solution in VS2005 and then press CTRL-Shift-N to pop up the search dialog.
A few things I learned while writing this:
- The documentation for EnvDTE and EnvDTE80 is pretty spotty and the API is buggy
- Writing the add-in was 11,000 times more work than I would have expected
- The code that is generated by the Visual Studio Add-in Wizard is BRITTLE
- The command name used by Visual Studio to identify and trigger a plug-in consists of the fully-qualified class name of your “Connect“ (Connect.cs is the file/class name that is generated by the VS2005 Add-in Wizard) class, a “dot“, and then the action name. The “connect“ class is the class that Visual Studio interrogates to register your add-in and also as a point of contact to determine which pieces of your add-in’s functionality is available and ready to run. In the case of my add-in, the “connect“ class is “Com.Benday.VisualStudio.SolutionSearch“ and the command is “ShowSearchDialog“.
- The action name cannot contain any periods
- The action name has a length limit but it’s really long
- If you’re wondering why you keep seeing the OnConnection() method being called where the connect mode is ext_ConnectMode.ext_cm_UIStartup instead of ext_ConnectMode.ext_cm_UISetup, go check out HKEY_CURRENT_USERSoftwareMicrosoftVisualStudio8.0PreloadAddinStateManaged in the registry. There’s probably a value defined saying that your add-in has already been initialized. Delete that value and restart.
Leave a Reply