Visual Studio Project vs. Solution

2019-01-21 08:56发布

Being new to VS, how may I think of these two concepts, what is the difference?

10条回答
仙女界的扛把子
2楼-- · 2019-01-21 09:13

I find some missing information in the other answers (at least for people who come from other IDEs like, say, Eclipse) . To say that a solution is a container for projects is only part of the thing. The conceptual feature of a VS project (what determines its 'granularity') is that one project produces one output: typically an executable or a library (dll). So, if you are going to code three executables that uses related code, you'll create one solution and at least three projects - probably more.

查看更多
Bombasti
3楼-- · 2019-01-21 09:14

A solution is a readable text file whose extension is .sln and having a structured content that describes the projects that it contains. A project is a readable XML formatted text file whose extension is .vcxproj and having a structured content according to its XML schema, and whose primary purpose is to contain the listing of source codes filenames and their dependencies or references to other project's source codes as well.

查看更多
时光不老,我们不散
4楼-- · 2019-01-21 09:18

Just to come up with a metaphor..

A solution is like a house, a project like a room. Each room provides a piece of functionality whereas the house, a container of rooms, provides the means to link the rooms together and organize them appropriately.

Kind of corny but I made it up on the fly, so bear with me :)

查看更多
干净又极端
5楼-- · 2019-01-21 09:23

A Solution can have many Projects.

The Solution can also handle managing the dependencies between its different Projects...making sure that each Project gets Built in the appropriate order for the final Solution to work.

查看更多
登录 后发表回答