Controlling when a VsPackage is loaded
VS goes to great lengths not to load packages before they are needed. The documentation also asks developers of extensions to avoid loading at start-up. The funny thing is that there isn't any documentation describing how you make your package load at start-up!
If you provide a custom editor through the "Editors" registry key, your package will be loaded when the "Open with..." dialog is brought up, or when a file which is by default assigned to your editor is opened.
If you provide a Tools|Options page, your package will also be loaded when that page is selected (not when the Tools|Options dialog is opened).
If you provide information for the Help|About dialog (product name, description, and an icon), this info is retrieved and cached when running "devenv /setup" (which should happen at product installation and uninstallation).
Probably other types of bindings are in place for language or debugging services, etc... although I'm not knowledgeable about those areas. Basically, the different registry entries indicate what package to load for each custom editor / language service / text marker / etc...
When I switched ViEmu (my vi/vim emulation product) from being a custom editor into becoming a sort of "parasite" that intercepts every text editing window (IVsTextView), the package stopped being loaded automatically. The product would not work until you opened the Tools|Options|ViEmu page. So, I had to research how to force the package to be loaded.
It turns out there is an "AutoloadPackages" section in the Visual Studio registry hive (HKLM/Software/Microsoft/VisualStudio/7.1 for VS .NET 2003 or */8.0 for Visual Studio 2005). This section lists some "GUI context codes", and each context code key contains package GUIDs identifying which packages should be loaded on entry to that GUI mode. You can bind loading to the moment debugging is started, a solution is loaded, or some other situations.
There is no "EnvironmentStartup" key, but I found out that the "NoSolution" GUID performs that function. It is not only honored when you start up the environment with no solution, but also when a solution is double-clicked on (I assume it is done before actually starting to load the solution).
These GUIDs are available in vsshell.h in the Visual Studio .NET 2003 VSIP SDK and Visual Studio 2005 SDK. Look for "UICONTEXT_NoSolution" and you can see the other GUI context codes available.