Visual Studio中的构建解决方案、重新构建解决方案和清洁解决方案之间的区别是什么?
什么时候使用这些工具比较合适?
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命令行开关,但它们的功能与菜单项相同。)
其他回答
生成解决方案只生成解决方案中已更改的项目,而不影响未更改的程序集,
ReBuild首先清理解决方案中的所有程序集,然后构建整个解决方案,而不管所做的更改。
清洁,简单地清洗溶液。
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命令行开关,但它们的功能与菜单项相同。)
我认为人们忽略的一件重要事情是,构建和清理都是基于Visual Studio对项目/解决方案的了解来执行的任务。我看到很多人抱怨Clean不能工作,或者留下剩余的文件,或者不值得信赖,而事实上,你说它不值得信赖的原因实际上使它更值得信赖。
Clean只会删除Visual Studio或编译器自己实际创建的文件和/或目录。如果你复制自己的文件,或者从外部工具或源创建的文件/文件夹结构,那么Visual Studio不会“知道它们的存在”,因此不应该接触它们。
你能想象如果Clean操作基本上执行了“del *”。*”?这可能是灾难性的。
Build对更改的或必要的项目执行编译。
不管更改或需要什么,Rebuild都会执行编译。
Clean会删除过去创建的文件/文件夹,但会保留最初与之无关的任何内容。
我希望这能说明一点问题并有所帮助。
构建解决方案-构建解决方案将构建您的应用程序,构建有任何文件更改的项目的数量。并且它不清除任何现有的二进制文件,只是替换bin或obj文件夹中的更新程序集。
重建解决方案-重建解决方案将通过构建解决方案中可用的所有项目来构建您的整个应用程序,并清理它们。在构建之前,它会清除bin和obj文件夹中的所有二进制文件。
清洁解决方案-清洁解决方案只是清除bin和obj文件夹中的所有二进制文件。
生成解决方案-生成已更改文件的任何程序集。如果程序集没有任何更改,则不会重新构建它。也不会删除任何中间文件。
最常用的。
重新构建解决方案——无论发生什么更改,都重新构建所有程序集,但保留中间文件。
当您注意到Visual Studio没有将您的更改合并到最新程序集中时使用。有时候Visual Studio也会犯错误。
清洁解决方案-删除所有中间文件。
当一切都失败,你需要清理一切,重新开始时使用。