none
VsPackage: How to start a VsPackage when VS starts?

    Question

  • Hello.
    I'm using VS & VS SDK 2008 and .NET 3.5 in Windows XP.

    I'm developing a VsPackage with several custom menu commands and tool windows. (it doesn't have a custom editor)
    But the constructor of my VsPackage is called only when one of those menu commands or tool windows is selected. Can I start the VsPackage from the beginning, when VS starts?

    Thank you!
    • Edited by nyam Sunday, March 01, 2009 11:41 AM added contents
    Sunday, March 01, 2009 11:10 AM

Answers

  • You can use the ProvoideAutoLoadAttribute to do this.  The attribute goes above your main package class definition.
    [ProvideAutoLoad(Microsoft.VisualStudio.Shell.Interop.UIContextGuids80.NoSolution)]
    • Proposed as answer by FengChen Sunday, March 01, 2009 12:31 PM
    • Marked as answer by nyam Monday, March 02, 2009 6:46 AM
    Sunday, March 01, 2009 12:10 PM
  • More details:
    http://msdn.microsoft.com/en-us/library/bb166762.aspx

    Return to the source, learn the way!
    • Marked as answer by nyam Monday, March 02, 2009 6:46 AM
    Sunday, March 01, 2009 12:30 PM

All replies

  • You can use the ProvoideAutoLoadAttribute to do this.  The attribute goes above your main package class definition.
    [ProvideAutoLoad(Microsoft.VisualStudio.Shell.Interop.UIContextGuids80.NoSolution)]
    • Proposed as answer by FengChen Sunday, March 01, 2009 12:31 PM
    • Marked as answer by nyam Monday, March 02, 2009 6:46 AM
    Sunday, March 01, 2009 12:10 PM
  • More details:
    http://msdn.microsoft.com/en-us/library/bb166762.aspx

    Return to the source, learn the way!
    • Marked as answer by nyam Monday, March 02, 2009 6:46 AM
    Sunday, March 01, 2009 12:30 PM