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?
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?
Rebuild = Clean + Build (usually)
Notable details:
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.
All three actions correspond to MSBuild targets. So a project can override the Rebuild action to do something completely different.
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.
Another difference: Clean clears the test results in Test Explorer, which Rebuild doesn't.
Documentation for Visual Studio 2022 explains:
Build or Build Solution, or press Ctrl+Shift+B, to compile only those project files and components that have changed since the most recent build. The Build command becomes Build Solution when a solution includes more than one project.Rebuild Solution to "clean" the solution and then build all project files and components.Clean Solution to delete any intermediate and output files. With only the project and component files left, new instances of the intermediate and output files can then be built.This, and more information, here: https://docs.microsoft.com/en-us/visualstudio/ide/building-and-cleaning-projects-and-solutions-in-visual-studio?view=vs-2022