DEV Community

DotNetCrunch
DotNetCrunch

Posted on • Edited on

Difference between Build Rebuild and Clean in Visual Studio

Some programmers have made this a habit of doing clean + build every time they change code without knowing the significance of it.

Some of them always prefer to do a rebuild every time the change or modify some parts of the code.

With the help of this post, we are trying to list out the significance of each – build rebuild and clean options and make readers understand when to use them.

Build Solution

The build solution will always perform an incremental build. i.e It will only build those files which have changed. The files which aren’t modified or changed won’t be built.

Rebuild Solution

Rebuild solution will delete all the compiled files(DLLs and EXE) and will perform build from scratch irrespective of whether the files are modified or not. It is a combination of Clean + Build.

Clean Solution
The clean solution will delete all the compiled files(DLLs and EXE) from bin/obj directories.

Difference Build Rebuild and Clean in visual studio

The difference lies in the way the build and clean happens for every project.

For example, if the solution has two projects – Project 1 & Project 2 and you do a rebuild, it will take Project 1, clean (delete) the compiled files for Project 1, and build it. After that, it will take Project 2, clean the files for Project 2, and build it.

On the other hand, if you do a clean and build, it will first clean (delete) all compiled files(DLLs and EXE) for both the projects – Project 1 & Project 2 and then it will build Project 1 first, followed by Project 2.

Read more at https://dotnetcrunch.in/build-rebuild-and-clean-in-visual-studio/

Thank you!

Top comments (0)