Wednesday, November 20, 2013

Visual Studio : Build Solution, Rebuild Solution and Clean Solution

You may also like to see:
Visual Studio : How to rename a solution

I always thought of what is the difference in Build, Rebuild and Clean Solution and which one is appropriate to use at which time?

So I tried to find the reason and here is my findings.

Clean solution

will remove the build intermediate files from the previous build. If there are any other files in the build target directories like bin and obj they may not be removed, but actual build artifacts will be removed.

Build solution

will build assemblies, if there is no change in assembly after previous build then it would not build the assembly. So it use partially-built wherever changes occurred after previous build.


Rebuild solution

will clean and then build the solution from scratch, regardless of changes has been occurred or not.



Here comes another question, rebuild will clean and then build the solution, so Is it equivalent to Clean Solution and then Build the solution?


Actually No!!! they are not equal.

The difference is in the sequence projects get clean and build. Let say we have two projects in a solution. Clean and then build will perform clean to both projects and then build will occur individually while on rebuild project A will get and clean and then build after that project B will be clean and then build and so on.



If you have any comments please do post.

You may also like to see:
Visual Studio : How to rename a solution

4 comments:

  1. Thx brother... very usefull for us. Been searching for Build + Clean thingy for 3 days.

    ReplyDelete
  2. Late comment, but it's worth saying. The difference between rebuild and clean + build becomes clearer if your projects have cross-dependencies (i.e. project 1 requires the project 2 dll AND vice-versa). Rebuild cleans and builds sequentially, allowing you to do this without problems. Clean + Build will cause problems in this case.

    ReplyDelete
    Replies
    1. Yes still worth saying for others that come along, like me. Many tell you what they mean but not which one is best and/or why, so TY!

      Delete
    2. Yes, still worth saying for many that come after, like me :) Many tell you what the options mean but not which option is best and/or why, so ty!!

      Delete

Life insurance policy, bank loans, software, microsoft, facebook,mortgage,policy,