Solved

What is the difference between build and rebuild a project?

Posted on 2007-03-28
2
341 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 69

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now