Udostępnij za pośrednictwem


Solutions as Containers

Visual Studio implements conceptual containers called solutions and projects to enable the integrated development environment (IDE) to apply its wide range of tools, designers, templates, and settings. Also, Visual Studio provides Solution Folders to organize related projects into groups and then perform actions on those groups of projects.

A project includes a set of source files, plus related metadata such as component references and build instructions. Projects generally produce one or more output files when built. A solution includes one or more projects, plus files and metadata that help define the solution as a whole:

ContainedSolutionObjects graphic

Visual Studio automatically generates a solution when you create a new project. As needed, you can then add other projects to the solution. Solution Explorer provides a graphical view of the entire solution that helps you manage its projects and files as you develop your application.

You can also create blank solutions without projects, enabling you to use the Visual Studio editors and designers to modify stand-alone files. Solution Explorer provides folders specifically for non-project items.

Because each project or solution comprises a directory and its contents, solutions and projects can be moved, copied, or deleted in Windows Explorer.

Solutions

Solutions manage the way Visual Studio configures, builds, and deploys sets of related projects. A Visual Studio solution can include just one project or several projects built jointly by a development team. A complex application might require multiple solutions.

Use Solution Build Configurations to specify how to build and deploy versions of your application for specific groups of users. You can, for example, configure debug builds for developers and testers, and retail builds for partners and end users. For further information on creating and using Solution Build Configurations, see Configuration Manager Dialog Box and Building in Visual Studio.

Advantages

Solutions allow you to concentrate on developing and deploying your projects, instead of sorting through all the details of managing project files, components, and objects. Each Visual Studio solution allows you to:

  • Work on multiple projects within the same instance of the IDE.

  • Work on items using settings and options that apply to an entire set of projects.

  • Use Solution Explorer to help develop and deploy your application.

  • Manage additional files opened outside the context of a solution or project.

Definition Files

Visual Studio stores the definition for a solution in two files: .sln and .suo. In previous versions of Visual Studio, you might have noticed the group (.vbg) or workspace (.dsw) files in Visual Basic and Visual C++, respectively.

The solution definition file (.sln) stores the metadata that defines your solution:

  • Projects that are associated with the solution.

  • Items available at the solution level that are not associated with a particular project.

  • Solution build configurations that set which project configurations to apply in each type of build.

The metadata stored in the .suo file as you construct a solution and set its properties is used to customize the IDE whenever the solution is active. For example, Solution Explorer displays a Miscellaneous Files folder for a solution if you enable that option, and tools appropriate for the types of projects included in the solution become available from the Toolbox.

Note

The .sln file can be shared between developers on a development team. The .suo file is a user-specific file, and cannot be shared between developers.

See Also

Tasks

How to: Edit Common Properties for Solutions

Concepts

Introduction to Solutions, Projects, and Items

Project Items

Projects as Containers

Solution Folders

Reference

Build and Run, Projects and Solutions, Options Dialog Box

General, Projects and Solutions, Options Dialog Box

Toolbox

Other Resources

Solution, Project, and File User Interface Elements