In Visual Studio, the terms “Build” and “Rebuild” refer to different actions you can perform on your project. Here's what each action does:
-
Build: When you select “Build” in Visual Studio, it compiles only the source files that have changed since the last build, as well as any dependencies that need to be updated. It performs an incremental build, which means it tries to compile only the necessary files to save time. The output of the build is typically an executable file or a library.
-
Rebuild: The “Rebuild” option, on the other hand, cleans the entire project and then performs a full build from scratch. It ignores any incremental build optimizations and compiles all the source files, regardless of whether they have changed or not. This ensures a clean and consistent build, but it may take longer to complete compared to a regular build.
When should you use each option?
-
Use “Build” when you want to quickly compile your project and only update the necessary files that have changed since the last build. It is the default and most commonly used option during development when you don't need to start from a completely clean state.
-
Use “Rebuild” in the following situations:
- When you suspect there might be build-related issues, such as unresolved dependencies or corrupted object files.
- When you have made significant changes to your project's configuration, like adding or removing files, modifying build settings, or updating references.
- When you want to ensure a clean build without any remnants of previous builds.
In summary, “Build” is used for incremental compilation of modified files, while “Rebuild” is used for a complete clean build.