views:

368

answers:

5

Can someone briefly explain to me the difference between Visual Studio's solution file (.sln) and project file (.vcproj).

It seems to me opening either one open the correct solution/project in Visual Studio. Is one the super-set of the other?

Note: I am currently using Visual Studio 2008 working on a project that was brought forward from Visual Studio 2005 (I believe).

A: 

Solution files are typically made up of multiple project files.

jamesaharvey
+6  A: 

A solution is a set of projects. If you need more than one project in your software, then go with solutions. I.E.: A Class Library Project + A Web Application Project.

Pablo Santa Cruz
+1  A: 

A project file typically corresponds to a single module: EXE or DLL or LIB. A solution manages a collection of project files.

Brian Ensink
+2  A: 

A solution is a collection of projects. Visual Studio is made so that it cannot function without a solution, so if you open a bare project, it will generate the solution automatically (or try to find one).

Vilx-
+1  A: 

One solution can contain zero or more projects. Everything is in projects, so a solution with zero projects doesn't contain anything at all besides the solution properties.

Visual studio keeps track of where the projects are used, so if you open a project file, it will open (IIRC) the last solution where it was used.

When you create a project from scratch, a solution is also created, but it's not shown until you add another project to it. It looks like you have only the project open, but it's actually a solution containing the project that is open.

Guffa