什麼叫做build(O)驚喜(X)

剛進公司時常聽到BuildBuildBuild,到底什麼叫做build(O)驚喜(X),Rebuild又是什麼?


 

簡單說,Build就是"編譯",是將程式碼,轉換成機器可以看得懂的語言,我猜想大概就是01010101這樣的東西吧(笑)

至於Build跟Rebuild有啥不同,一般来说Rebuild=99%*(Clean+Build),在非常小的可能性下會不同,一般可以忽略。

Rebuild是對Solution下的所有项目,全部進行 Clean+Build,不論是否更新過文件

Build是對選中的项目

簡言之,Build只是針對有更改過的文件進行編譯,而Rebuild會編譯所有。如果不趕時間的話,都Rebuild吧

在Stack Overflow看到以下定義覺得還滿貼切的

  • 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 :)