• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 400
  • Last Modified:

What is the difference between build and rebuild a project?

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
karanba
Asked:
karanba
2 Solutions
 
Éric MoreauSenior .Net ConsultantCommented:
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
 
mrwad99Commented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now