Enterprise application developers who use your VS Package can conveniently group similar types of projects together in Visual Studio by using project nesting. For example, the Enterprise Template project uses nested projects to group projects into categories. Business facade projects, Web UI projects, and so on are grouped together in one category.
In this scenario, there is no limit to the number of projects the developer can nest under each parent project, although the developer can programmatically provide limits. This type of grouping can also be made recursive, in which case the projects of the same type as a child project can be nested under the child to become a subproject of the child, which is a subproject of the parent. For more information, see Getting Started With Visual Studio Templates and Policy in Distributed Applications.
Project nesting is not an intrinsic part of Visual Studio. You have to write the code to enable nesting and subproject nesting within child projects. The parent project is a special VSPackage, or project type, created and registered with its own GUID that includes the code that is required to implement project nesting.
Project Nesting in the Figures Sample
The sample Figures Project provides an example of the implementation of project nesting. Figures Project is a project type that implements the Figures language and automatically nests a C# project. The project type is implemented in this manner because the project is designed to take the Figures language and produce C# code, but there is no intrinsic ability in the sample to compile C# code to the Microsoft intermediate language (MSIL). For more information relating to MSIL, see Compiling to MSIL.
In this scenario, the Figures Project compiler is used to compile the figures files to C# files. The C# project is nested in the Figures Project, and the project files are contained in the C# project. The C# project is called by the IDE to build the figures project files and handles building the Figures projects into executable code.
An example of project nesting from the Figures Project is shown in the following illustration. In this example, BuildProject1 is nested within Project1, and BuildProject2 is nested within Project2. Both Project1 and Project2 are parent projects that are contained in the solution Nested Projects.
Nested projects example
.gif)
See Also
Concepts
How to: Implement Nested Projects
Considerations for Unloading and Reloading Nested Projects
Wizard Support for Nested Projects
Registering Project and Item Templates
Implementing Command Handling for Nested Projects
Filtering the AddItem Dialog Box for Nested Projects