Udostępnij za pośrednictwem


How to: Create Multi-Project Solutions

You can create a multi-project solution by adding one or more projects to any existing solution. For information about how to create a solution, see How to: Create Solutions and Projects.

When you create a multi-project solution, the first project that you create becomes the startup project, by default. The startup project appears in bold font in Solution Explorer and runs when, on the menu bar, you choose Debug, Start. You can also start to debug all projects in a solution simultaneously or debug one or more projects in the solution by specifying the solution as the startup project. For more information, see How to: Modify Project Properties and Configuration Settings.

You can use the Blank Solution template to create an empty solution container to which you can add projects and items. You can find this template by opening the New Project dialog box, expanding Other Project Types in the Installed Templates list, and then choosing Visual Studio Solutions.

The framework for the physical association of your solution's files is established when you create a file or a project.

Adding and Deleting Projects in a Solution

You can create a project and add it to a solution, or you can add an existing project to a solution. You can delete solutions only in the File Explorer, not in Visual Studio.

To create a project and add it to a solution

  1. In Solution Explorer, choose the solution or the solution folder to which you want to add a project that you create.

  2. On the menu bar, choose File, Add, New Project.

  3. In the left pane, select Installed, and select a category of project types from the expanded list.

  4. Select one of the project Templates from the middle pane.

  5. In the Name box, type a name for the new project and then select OK.

You can add an existing project to a solution and then edit that project to meet the requirements of the current solution.

To add an existing project to a solution

  1. In Solution Explorer select the solution to which you want to add a project.

  2. On the shortcut menu, choose Add, Existing Project, and select the project that you want to add to the solution.

To delete a solution

  1. Remove any projects in the solution that you might want to use again. You can cut the project directory from the solution folder and paste it to another location. You may have to adjust some references.

  2. Delete the solution directory.

See Also

Tasks

How to: Modify Project Properties and Configuration Settings

Concepts

How to: Create Solutions and Projects