locked
How to close project property page RRS feed

  • Question

  • Any idea how can I close the property page? is there a method to close all project pages?

    In my case I unloading the project, but property page remains open after unload with can cause some problems down the road.

    Guid projectGUID = Guid.Empty;
    IVsSolution.GetGuidOfProject(DTEUtil.GetIVsHierarchy(p), out projectGUID);
    IVsSolution4.UnloadProject(ref projectGUID, (uint)_VSProjectUnloadStatus.UNLOADSTATUS_UnloadedByUser);


    Wednesday, May 6, 2015 2:24 PM

Answers

  • Seems that what i need is to call IVsSolution.CloseSolutionElement

    IVsHierarchy hier = DTEUtil.GetIVsHierarchy(p);
    Guid projectGUID = Guid.Empty;
    IVsSolution.GetGuidOfProject(hier, out projectGUID);
    IVsSolution.CloseSolutionElement((uint)__VSSLNCLOSEOPTIONS.SLNCLOSEOPT_UnloadProject, hier, 0);
    Closing the project using this interface seems to remove the need for UnloadProject call and also close all open items.


    • Marked as answer by pepone.onrez Thursday, May 7, 2015 7:05 AM
    Wednesday, May 6, 2015 3:03 PM

All replies

  • Seems that what i need is to call IVsSolution.CloseSolutionElement

    IVsHierarchy hier = DTEUtil.GetIVsHierarchy(p);
    Guid projectGUID = Guid.Empty;
    IVsSolution.GetGuidOfProject(hier, out projectGUID);
    IVsSolution.CloseSolutionElement((uint)__VSSLNCLOSEOPTIONS.SLNCLOSEOPT_UnloadProject, hier, 0);
    Closing the project using this interface seems to remove the need for UnloadProject call and also close all open items.


    • Marked as answer by pepone.onrez Thursday, May 7, 2015 7:05 AM
    Wednesday, May 6, 2015 3:03 PM
  • Thank you for sharing the experience here.

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, May 7, 2015 2:46 AM