在Visual Studio 2008中进行重建和清洁+构建之间的区别是什么?清洁+重建与清洁+重建不同吗?


当前回答

另一个不同之处是:Clean会清除测试资源管理器中的测试结果,而Rebuild不会。

其他回答

重建=清洁+构建(通常)

值得注意的细节:

For a multi-project solution, "rebuild solution" does a "clean" followed by a "build" for each project (possibly in parallel). Whereas a "clean solution" followed by a "build solution" first cleans all projects (possibly in parallel) and then builds all projects (possibly in parallel). This difference in sequencing of events can become significant when inter-project dependencies come into play. All three actions correspond to MSBuild targets. So a project can override the Rebuild action to do something completely different.

另一个不同之处是:Clean会清除测试资源管理器中的测试结果,而Rebuild不会。

在这篇博客文章中,作者链接了对这个问题的评论:

其实不! !它们是不平等的。 不同之处在于项目从清洁到构建的顺序。让 假设我们在一个解决方案中有两个项目。清洁,然后建立意志 对两个项目执行clean,然后将单独进行构建 而在重建时,项目A将获得和清洁,然后再建造 项目B将会是干净的,然后建造等等。

Visual Studio 2022的文档解释说:

Choose Build or Build Solution, or press Ctrl+Shift+B, to compile only those project files and components that have changed since the most recent build. The Build command becomes Build Solution when a solution includes more than one project. Choose Rebuild Solution to "clean" the solution and then build all project files and components. Choose Clean Solution to delete any intermediate and output files. With only the project and component files left, new instances of the intermediate and output files can then be built.

更多信息请访问:https://learn.microsoft.com/en-us/visualstudio/ide/building-and-cleaning-projects-and-solutions-in-visual-studio?view=vs-2022

Earl在99%的情况下重建=清洁+构建是正确的。

但不能保证它们是一样的。这3个动作(重建、构建、清除)代表不同的MSBuild目标。每一个都可以被任何项目文件覆盖以执行自定义操作。因此,在启动clean + build(或完全删除它们)之前,完全有可能覆盖rebuild来执行几个操作。

这是一个非常极端的情况,但由于评论讨论而指出了它。