Solved

What is the difference between build and rebuild a project?

Posted on 2007-03-28
2
370 Views
Last Modified: 2013-11-26
Hi,

I want to ask that what is the difference between build and rebuild a project in Visual Studio.
And I what is the difference between debug and trace.

And also I want to here more about this kind of terms that comes in programing, advice me some resource that clearly describe.

thanks.
0
Comment
Question by:karanba
2 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 70 total points
ID: 18814692
Build is not suppose to process files that haven't changed since last compilation. Rebuild don't check that, it recompiles everything.

Debug is only in the debug configuration while Trace is available is available in Debug and Release configuration.
0
 
LVL 19

Assisted Solution

by:mrwad99
mrwad99 earned 55 total points
ID: 18814696
I am going to answer this in terms of C++.

When you build a project in VS, if the project has not been built before, you will find that not only do you get your EXE or DLL generated, but you also get various intermediary files too.  These will have extensions .obj (object files) .pdb (program database files) and possibly .ilk (incremental link files).  Each time you build the project, these will get updated.

So.  Say you have a solution that has one DLL, and one executable.  You build the DLL and the executable together by building the solution, then discover that you need to change the executable code somewhat.  So, you make the code changes in the EXE and build the solution.  This time, you will see that the DLL is not built; it has not been changed - so why would it be?  The executable is rebuilt however, to encorporate the changes you just made.  Now try a rebuild.  This time, both the DLL and the EXE are built, as you are essentially saying to VS "even if a project has been built, I want you to build it again".

So why did I mention the intermediary files?  You will notice that a rebuild first performs a *clean*, which removes all the output files generated by the last build (if there was one) then performs the build.  So, all the .obj, .pdb etc files will be regenerated, even if there are no changes that require this.

This is why a rebuild takes no longer than a normal build.  There are advantages to this however.  Sometimes I find the strangest of crashes/inconsistences, that are solved when I do a rebuild, possibly due to the various DLL/EXE files becoming out of step.  Also, a rebuild is essential when porting code from an older compiler - you dont want to be using binaries built in one compiler with those built in another, as there may be issues such as updates to various header files meaning structure size differences/different alignment of variables, which could cause very hard to diagnose problems.

HTH
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question