Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
3.00/5 (3 votes)
See more:
Hi,

I am working in one project in that when i build the project the dll file is creating/modifying but dll created date is not changing. But when i Re-Build my project the dll file is newly creating with the current date .

So, What is the main difference between building the project and rebuilding the project in visual studio.

Regards,
Srinubabu.
Posted

Build means compile and link only the source files that have changed since the last build.
Rebuild means compile and link all source files regardless of whether they changed or not.

But they are not guaranteed to be the same. The 3 actions (rebuild, build, clean) represent different MSBuild targets. Each of which can be overriden by any project file to do custom actions. So it is entirely possible for someone to override rebuild to do several actions before initiating a clean + build (or to remove them entirely).

Build is the normal thing to do and is faster. Sometimes the versions of project target components can get out of sync and rebuild is necessary to make the build successful. In practice, you never need to Clean.
Rebuild = Clean + Build

Build or Rebuild Solution builds or rebuilds all projects in the your solution, while Build or Rebuild <project name=""> builds or rebuilds the StartUp project.
(To set the StartUp project, right click on the desired project name in the Solution Explorer tab and select Set as StartUp project. The project name now appears in bold.)

All source files that have changed are saved when you request a build/rebuild, so you don't have to save them first.
When you run your executable (F5 or Ctrl-F5), Visual Studio saves all your changed source files and builds anything that changed, so you don't need to explicitly do those steps every time. This allows for quick "trial and error" debugging.
 
Share this answer
 
v2
Comments
Abhinav S 5-Jul-12 5:36am    
Similar to my answer (but with additional info). 5.
Prasad_Kulkarni 5-Jul-12 5:38am    
Thank you Abhinav!
Srinubabu Ravilla 5-Jul-12 5:41am    
Thank you Abhinav
Sandeep Mewara 5-Jul-12 5:49am    
Yep. 5!
Prasad_Kulkarni 5-Jul-12 5:52am    
Thank you Sandeep!
Build will only compile the files that have changed since the last time you did a build.

A rebuild removes all the old files (performs a clean) and then builds all the files).

In essence Rebuild = Clean + Build.
 
Share this answer
 
Comments
Prasad_Kulkarni 5-Jul-12 5:39am    
:) My 5 too..
Abhinav S 5-Jul-12 5:48am    
Thanks.
Sandeep Mewara 5-Jul-12 5:48am    
Yep. 5!
Abhinav S 5-Jul-12 5:57am    
Thank you.
[no name] 5-Jul-12 6:16am    
+5
From http://www.cs.tufts.edu/r/graphics/resources/vs_getting_started/vs_getting_started.htm[^], which I found with a Google search of build rebuild visual studio:

Build means compile and link only the source files that have changed since the last build, while Rebuild means compile and link all source files regardless of whether they changed or not. Build is the normal thing to do and is faster. Sometimes the versions of project target components can get out of sync and rebuild is necessary to make the build successful. In practice, you never need to Clean.

Build or Rebuild Solution builds or rebuilds all projects in the your solution, while Build or Rebuild <project name> builds or rebuilds the StartUp project, "hello" in the screen shot above. To set the StartUp project, right click on the desired project name in the Solution Explorer tab and select Set as StartUp project. The project name now appears in bold. Since the homework solutions typically have only one project, Build or Rebuild Solution is effectively the same as Build or Rebuild <project name>.

Compile just compiles the source file currently being edited. Useful to quickly check for errors when the rest of your source files are in an incomplete state that would prevent a successful build of the entire project. Ctrl-F7 is the shortcut key for Compile.
 
Share this answer
 
v2
Comments
Srinubabu Ravilla 5-Jul-12 5:41am    
Thank you nileshbhai
Sandeep Mewara 5-Jul-12 5:49am    
Yep 5!
Build compiles the files that have changed since your last build.
But Rebuild will compile all the files from scratch (regardless files have been changed or not).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900