visual-studio Visual Studio 中的解决方案文件与项目文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1428265/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Solution file vs. Project file in Visual Studio
提问by Mark Norgren
Can someone briefly explain to me the difference between Visual Studio's solution file (.sln) and project file (.vcproj).
有人可以向我简要解释一下 Visual Studio 的解决方案文件 (.sln) 和项目文件 (.vcproj) 之间的区别。
It seems to me opening either one open the correct solution/project in Visual Studio. Is one the super-set of the other?
在我看来,在 Visual Studio 中打开任何一个打开正确的解决方案/项目。一个是另一个的超集吗?
Note: I am currently using Visual Studio 2008 working on a project that was brought forward from Visual Studio 2005 (I believe).
注意:我目前正在使用 Visual Studio 2008 处理从 Visual Studio 2005(我相信)提出的项目。
采纳答案by Pablo Santa Cruz
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.
解决方案是一组项目。如果您的软件中需要多个项目,请选择解决方案。IE:一个类库项目 + 一个 Web 应用程序项目。
回答by Brian Ensink
A project file typically corresponds to a single module: EXE or DLL or LIB. A solution manages a collection of project files.
项目文件通常对应于单个模块:EXE 或 DLL 或 LIB。解决方案管理一组项目文件。
回答by Vilx-
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).
解决方案是项目的集合。Visual Studio 的设计使其在没有解决方案的情况下无法运行,因此如果您打开一个裸项目,它将自动生成解决方案(或尝试找到一个)。
回答by Guffa
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.
Visual Studio 会跟踪项目的使用位置,因此如果您打开一个项目文件,它将打开 (IIRC) 最后一个使用它的解决方案。
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.
当您从头开始创建项目时,也会创建一个解决方案,但在您向其中添加另一个项目之前不会显示该解决方案。看起来您只打开了项目,但它实际上是一个包含打开的项目的解决方案。
回答by jCisco
Specifically project files are intended to contain the data required to build the files in the project into an exe or dll. This file is utilized by the local compilers or with systems such as Team Foundation system and server side build agents.
具体而言,项目文件旨在包含将项目中的文件构建为 exe 或 dll 所需的数据。此文件由本地编译器或 Team Foundation 系统和服务器端构建代理等系统使用。
Solutions are a client (IDE) construct designed to manage collections of projects, which in effect is a collection of different build definitions and associated files.
解决方案是一种客户端 (IDE) 构造,旨在管理项目集合,实际上是不同构建定义和关联文件的集合。
回答by jamesaharvey
Solution files are typically made up of multiple project files.
解决方案文件通常由多个项目文件组成。

