When to load package

Hello,

I need to listen for solution events (e.g. OnAfterOpenProject) in my package.  I originally set my package to load when a solution exists using the following registration attribute:

[MSVSIP.ProvideAutoLoad(EnvDTE80.ContextGuids.vsContextGuidSolutionExists)]

I believe this works as it should; it fires after the solution has opened.  Unfortunately, I do not get an opportunity to hook up my event handlers for solution events like OnAfterOpenProject as my package has not yet loaded.  Should I register my package so that it autoloads with VS   If so, how would I do this   If not, what is the best stage to load my package if I wish to reliably capture solution events

Thanks,

Notre


Answer this question

When to load package

  • smcneese

    Hi Notre,

    My package is unmanaged C++ (although I'm not too versed in the managed world, your post above seems to be using managed code). Anyway, as my product is a text editor enhancement, I needed to hook to any TextView registering event.

    The way I did it is by using the GUID "UICONTEXT_NoSolution" {ADFC4E64-0397-11D1-9F4E-00A0C911004F}. Given there is a UICONTEXT_SolutionExists, I'm guessing you should use vsContextGuidNoSolution (but I'm  just guessing).

    This forces the package to be loaded both when the environment is started alone, or when it is started by double-clicking on a solution file.

    Hope it works for you!

      J

    -------------------------------------------------
    ViEmu - vi/vim emulation for Visual Studio
        http://www.ngedit.com/viemu.html


  • When to load package