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

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


当前回答

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

其他回答

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

Clean将清除bin/Debug文件夹中的工件。删除bin/Debug文件夹中的所有文件。

Build检查bin/Debug文件夹中的构件,如果需要,然后创建构件(同时检查构建时错误)。

重建=清洁+一次构建。这将首先删除bin/Debug文件夹中的所有文件,然后在bin/Debug文件夹中再次创建工件。

您可以通过打开并观察bin/Debug(或Release)文件夹,然后清理、构建和重建项目来确认这些操作。

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

生成解决方案只生成解决方案中已更改的项目,而不影响未更改的程序集,

ReBuild首先清理解决方案中的所有程序集,然后构建整个解决方案,而不管所做的更改。

清洁,简单地清洗溶液。

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

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

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

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