Visual Studio中的构建解决方案、重新构建解决方案和清洁解决方案之间的区别是什么?

什么时候使用这些工具比较合适?


当前回答

**Build ,Rebuild, Clean Solution**

清洁解决方案 :删除所有编译过的文件(所有dll和exe)。

构建解决方案 :编译已更改的代码文件(dll和exe)。

重建方案 :删除所有编译过的文件,并重新编译它们,不管代码是否已经更改。

其他回答

摘自此链接:

构建意味着只编译和链接已更改的源文件 从上次构建开始,而重新构建 意味着编译和链接所有源代码 文件,不管它们是否 改变与否。构建是常态 要做的事情,而且更快。有时 项目目标的版本 组件可能会不同步 重建是进行构建所必需的 成功的。在实践中,你永远不会 需要清洁。

我有一个空白的解决方案BuildRebuildClean和三个类库模型,存储库,通知。

我在通知类库中使用模型和库。

然后:

生成解决方案增量生成,只编译已更改的文件。如果一个程序集没有变化, 它不会被重建。此外,它不会删除任何中间文件。 如果在模型库项目中修改一些代码,则BUILD解决方案。 在下面的屏幕截图中,参考DLL的时间戳,在Models和Notification库中更新了EXE。

重建解决方案删除所有编译文件和编译所有不考虑更改, 忽略之前做过的任何事情。 右键单击解决方案名称BuildRebuildClean。它所做的是删除所有的程序集, EXEs和引用文件再次编译。

清洁解决方案删除bin/obj目录下所有已编译的中间文件(即exe和dll)。

这只涉及“构建解决方案”选项。

我完全受够了Visual Studio无法真正清理解决方案,所以写了这个小工具来为你做这件事。

首先在VS中关闭你的解决方案,并将它的文件夹从Windows资源管理器拖到这个应用程序或它的图标中。根据窗口底部的设置,它还可以删除额外的东西,这将有助于你手动上传你的解决方案到GitHub或与他人共享:

简而言之,它会把所有的“调试”文件夹、智能感知和其他可以被VS重建的缓存放入回收站。

Build solution will perform an incremental build: if it doesn't think it needs to rebuild a project, it won't. It may also use partially-built bits of the project if they haven't changed (I don't know how far it takes this) Rebuild solution will clean and then build the solution from scratch, ignoring anything it's done before. The difference between this and "Clean, followed by Build" is that Rebuild will clean-then-build each project, one at a time, rather than cleaning all and then building all. Clean solution will remove the build artifacts from the previous build. If there are any other files in the build target directories (bin and obj) they may not be removed, but actual build artifacts are. I've seen behaviour for this vary - sometimes deleting fairly thoroughly and sometimes not - but I'll give VS the benefit of the doubt for the moment :)

(这些链接指向devenv.exe命令行开关,但它们的功能与菜单项相同。)

我只是认为重建是先执行清理,然后再执行构建。也许我错了……评论?