97

What does this option do? It is accessible from the Build menu.

7 Answers 7

109

It deletes all the compiled and temporary files associated with a solution. It ensures that the next build is a full one, rather than only changed files being recompiled.

5
  • 3
    Then what is the difference between "Build" and "Rebuild All?"
    – Chad
    Oct 14, 2010 at 18:44
  • 2
    Imagine a solution with 3 projects. Build only compiles the projects which have changed, since the last build. Rebuild, compiles everything.
    – BigJump
    Jan 19, 2011 at 10:24
  • 18
    Is Rebuild Solution essentially the same as running Clean Solution and then Build Solution?
    – Joey Green
    Feb 23, 2011 at 18:34
  • 5
    Does Rebuild Solution actually do a Clean before Building, or does it just Build everything as if a Clean had been done first?
    – Homer
    Apr 26, 2012 at 17:30
  • 2
    @JoeyGreen No. If you Clean and Build solution, it first cleans all projects and then build all projects. If you Rebuild, it takes one project at the time and clean it and build it. Once, I've encounter weird issue using Rebuild instead of Clean&Build, because some project dependencies...
    – relaxxx
    Oct 2, 2014 at 9:28
61

It deletes all the object code generated during previous compilation/build. It deletes all below kind of files:-

*.obj - object code

*.pdb - program debug databse file

*.bsc - source browser databse

*.ilk - incremental linker file

*.sbr - source browser intermediate file

*.idb - rebuild dependency file

*.lib - library file

*.exe - executable

JFYI - Even a Rebuild All command will do all this and then go on to build the complete set of source files.

-AD

11

I wanted this to be a comment but apparently need 50 rep.

To warn others, I find the rebuild solution doesn't do a clean myself. I'll often not I need to clean it and build/rebuild it after for it to work - I think rebuild it's self forces a full compile without clean and overrides everything, but does not get rid of the extras.

Did not look into what rebuild does code wise, just a general observation in case someone else has the same issue.

1
  • 2
    I concur with this statement - have seen this behaviour many times where a clean before a rebuild is required Aug 17, 2012 at 3:51
5

This is an old post, but I thought this was worth mentioning. When coding for Silverlight, I usually have Blend and VS2010 open at the same time. Because of that, sometimes VS2010 freaks out and IntelliSense can't find where stuff is or something, resulting in it falsely highlighting a lot of errors.

Cleaning the solution fixes this.

4

Erases files created during compilation process. Effectively forces a full recompile/build next time.

2

careful when you are cleaning a solution; when you do clean a solution and if you reference to a library (say nhibernate) in your project and if that library has a dependency ( say iesi.collections) , then you'll see iesi.collections will be deleted even if you rebuilt the solution and you have to put that dll to your folder, again. or you can also reference to iesi.collections and choose copy-local : yes option from its properties

2
  • 5
    This shouldn't be a problem if you move all your libs to a specific folder other than 'Bin' and/or use NuGet Sep 2, 2011 at 3:34
  • sure its not but usually its located with the bin folder ( you can try getting fluentnhibernate via nuget and iesi.collections is not there )
    – ersanbilik
    Jun 21, 2012 at 12:15
0

FYI, neither Clean nor Rebuild will delete non-build files, eg files copied during a pre-build command. I had been confused about that!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.