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

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


当前回答

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命令行开关,但它们的功能与菜单项相同。)

其他回答

**Build ,Rebuild, Clean Solution**

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

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

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

构建解决方案-构建解决方案将构建您的应用程序,构建有任何文件更改的项目的数量。并且它不清除任何现有的二进制文件,只是替换bin或obj文件夹中的更新程序集。

重建解决方案-重建解决方案将通过构建解决方案中可用的所有项目来构建您的整个应用程序,并清理它们。在构建之前,它会清除bin和obj文件夹中的所有二进制文件。

清洁解决方案-清洁解决方案只是清除bin和obj文件夹中的所有二进制文件。

我所知道的是一个清洁不做什么“使清洁”用来做-如果我清洁一个解决方案,我希望它删除obj和bin文件/文件夹,这样它就像是一个新的签出源。根据我的经验,虽然我经常发现,清洁和构建或重建仍然会在已知编译的源代码上产生奇怪的错误,需要手动删除bin/obj文件夹,然后它就会构建。

构建解决方案将构建解决方案中已更改的任何项目。重建构建所有项目,清洁解决方案删除所有临时文件,确保下一次构建完成。

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