Wednesday, December 16, 2015

Building Solutions in Visual Studio – Build Vs. Rebuild

“Build Solution” and “Rebuild Solution” are the most commonly used features in Visual Studio.  As a developer you writes code, build the solution and run the application in Visual Studio.  Very often you also used “rebuild solution” , or “clean and then build solution”.  Have you ever wonder why there are different options ? When to use them?  Though many of you are familiar with the details of  these but when asked, I have seen many beginners having confusion around it.

So let’s try to simply it by asking below questions
What is the difference between Build and Rebuild ?
When to use which option ?
How does clean relates , when to use it ?
One-liner Understanding…
Build Solution – Incremental build and compiles only the files that are changed.
Clean Solution – Deletes all compiled, intermediate files.
Rebuild Solution – Deletes all compiled files and compiles all irrespective of changes.

Build + Clean = Rebuild