How to unload the VSPackage under ceratin condition? ( VS SDK 2005 & 2008 C#) RRS feed

  • Question

  • Hi,

    I am developing a VSPackage in C# language in VS SDK 2005 & 2008.

    To load my package automatically when a solution is opened in the VS IDE i have used the AutoLoadProperty as shown below:



    I have a tool window in my package which gets automatically loaded when the solution is opened in IDE, beacuse i am creating the tool window in the intialize function.

    Now i want  my package to unload when the tool window is closed, and load the package when my tool window is again opened.

    And the behaviour of loading the package, when the solution is opened for the first time, after starting Visual studio should also exist.
    Is there a command which would help to load and unload VSPackage programmatically? so that i can add it under the Package menu?

    how can i achieve this?


    • Edited by Nayna Thursday, June 25, 2009 5:19 AM
    • Edited by Don Tan Friday, June 26, 2009 6:46 PM Fixing Thread Title bug
    Thursday, June 25, 2009 5:16 AM


  • There is no mecanism to unload packages once they are loaded.  The guidance here is that you should hide or disable your features based on the action of the user.  For example, you could respond to the action where the user closes his solution by hiding your toolwindow
    Carl Brochu, Visual Studio
    Thursday, June 25, 2009 9:04 PM