Export (0) Print
Expand All

IVsParentProject Interface

Allows nested projects to be opened and closed in the proper sequence with the build of the solution hierarchy by the environment.

Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop (in microsoft.visualstudio.shell.interop.dll)

[GuidAttribute("79001CD1-69C6-45B8-8F7A-DCCCE0469E8D")] 
[InterfaceTypeAttribute(1)] 
public interface IVsParentProject
/** @attribute GuidAttribute("79001CD1-69C6-45B8-8F7A-DCCCE0469E8D") */ 
/** @attribute InterfaceTypeAttribute(1) */ 
public interface IVsParentProject
GuidAttribute("79001CD1-69C6-45B8-8F7A-DCCCE0469E8D") 
InterfaceTypeAttribute(1) 
public interface IVsParentProject

IVsParentProject contains two methods, OpenChildren and CloseChildren. The purpose of this interface is to allow nested projects to be opened and closed in the proper sequence with the build of the solution hierarchy by the environment. Information relating to nested projects is contained in the project file for each parent project.

The implementation of the methods should fire the corresponding IVsSolutionEvents3 events - OnBeforeOpeningChildren and OnAfterOpeningChildren in the OpenChildren method and OnBeforeClosingChildren and OnAfterClosingChildren in CloseChildren method.

The solution open order is the following.

For each top level project in the solution:

  • The environment creates the project by calling the project's CreateProject

  • The environment adds the project to Solution Explorer.

  • The environment checks to see if the project is a parent project by querying the project hierarchy for IVsParentProject.

  • If the project supports IVsParentProject, the environment calls the project's OpenChildren method. During this method the project fires OnBeforeOpeningChildren, and for each child (nested) project:

    • The parent project calls AddVirtualProjectEx.

    • The method fires OnAfterOpenProject for the child project.

    • The environment checks to see if the child project is also a parent project by querying the child project's hierarchy for IvsParentProject.

    • If the child project is also a parent project:

    • The environment calls its OpenChildren.

    • The project fires OnAfterOpeningChildren.

    • The solution fires OnAfterOpenProject.

    • The solution fires OnAfterOpenSolution (if a solution loads successfully) .

The solution close order is:

  • For each top-level project in the solution the environment calls the project's QueryClose method. In this method, the project calls QueryClose on all of its children.

  • For each top level project in the solution, the environment fires OnBeforeCloseProject for the project.

  • For each top level project in the solution, the environment checks to see if the project is a parent project by querying the project hierarchy for IVsParentProject

  • For each top-level project in the solution, if the project supports IVsParentProject, the environment calls CloseChildren. During this method the project fires OnBeforeClosingChildren, and for each child (nested) project:

    • The parent project calls RemoveVirtualProject.

    • The method fires OnBeforeCloseProject for the child project

    • The environment checks to see if the child project is also a parent project by querying the child project's hierarchy for IVsParentProject

  • If the child project is also a parent project:

    • The environment calls its CloseChildren.

    • The environment calls the child project's Close.

    • The project fires OnAfterClosingChildren.

    • The environment calls the top level project's Close.

Notes to Implementers Implemented by Parent Projects (projects nesting other projects) to control opening and closing of nested (child) projects.

Community Additions

ADD
Show:
© 2014 Microsoft