Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Rebuild and Clean + Build in Visual Studio

What is the difference between just a Rebuild and doing a Clean + Build in Visual Studio 2008? Is Clean + Build different then doing Clean + Rebuild?

like image 736
Jim McKeeth Avatar asked Aug 07 '09 23:08

Jim McKeeth


People also ask

Is rebuild the same as clean and build?

For a multi-project solution, "rebuild solution" does a "clean" followed by a "build" for each project (possibly in parallel). Whereas a "clean solution" followed by a "build solution" first cleans all projects (possibly in parallel) and then builds all projects (possibly in parallel).

What is the difference between build and clean build?

Clean Solution : deletes all compiled files (all dll's and exe's ). Build Solution : compiles code files (dll and exe) that have changed.

What is the difference between build and rebuild?

The main difference between build and rebuild in Visual Studio is that the build helps to complete the code files that are changed, while rebuild deletes all previously compiled files and compiles the solution from scratch, ignoring anything done before.

What does it mean to rebuild solution in Visual Studio?

To build, rebuild, or clean an entire solution Choose Build All to compile the files and components within the project that have changed since the most recent build. Choose Rebuild All to "clean" the solution and then builds all project files and components. Choose Clean All to delete any intermediate and output files.


Video Answer


2 Answers

Rebuild = Clean + Build (usually)

Notable details:

  1. For a multi-project solution, "rebuild solution" does a "clean" followed by a "build" for each project (possibly in parallel). Whereas a "clean solution" followed by a "build solution" first cleans all projects (possibly in parallel) and then builds all projects (possibly in parallel). This difference in sequencing of events can become significant when inter-project dependencies come into play.

  2. All three actions correspond to MSBuild targets. So a project can override the Rebuild action to do something completely different.

like image 126
earl Avatar answered Sep 19 '22 06:09

earl


Earl is correct that 99% of the time Rebuild = Clean + Build.

But they are not guaranteed to be the same. The 3 actions (rebuild, build, clean) represent different MSBuild targets. Each of which can be overriden by any project file to do custom actions. So it is entirely possible for someone to override rebuild to do several actions before initiating a clean + build (or to remove them entirely).

Very much a corner case but pointing it out due to comment discussions.

like image 41
JaredPar Avatar answered Sep 21 '22 06:09

JaredPar