
130Microsoft Visual Studio 2010: A Beginner’s Guide
but projects that are untouched will be reused as is. A build is typically the fastest option during normal development because building only items that are out of date means that there are likely items that don’t need to be built. Be aware, though, that you’ll occasionally need to build everything to make sure you aren’t accidentally working with old code.
Rebuilding Solutions/Projects
A rebuild performs the same actions as a build, except that it forces the build of all items belonging to a project or solution. Reasons for a rebuild include ensuring new code you’ve written works with existing code, creating a fresh build for deployment, and ensuring important items are built when a normal build doesn’t work.
Many developers, including myself, like to pull the latest changes from source control into my solution every morning before starting work. This ensures that the current code in the solution will build with whatever was in source control. This keeps the code in your local solution from differing too much from what is in source control.
Before you deploy an application, you’ll want to perform a rebuild to ensure all of the code builds. Depending on your process, you will want to test the code that was just rebuilt, prior to deployment. The rebuild ensures that the application you are preparing for deployment is the most current.
Sometimes your normal build doesn’t work correctly or you’re seeing bugs that seem to be associated with code that you’ve already written. While VS is a great tool and manages dependencies between projects, there are still complex situations where everything doesn’t build correctly. At these times, you can try a rebuild, which forces the build on all items of a project or solution.
A rebuild takes more time to perform because all items in a project must be rebuilt. If you have a small project, you might not notice the differences. However, if you have a fairly large solution, with dozens of projects, a steady pattern of rebuilds throughout the day could cut into your productivity. A rebuild on a project is often not much more work than a build on the project, but there are probably edge cases where the difference in time would be noticeable. It is the rebuild on the solution that will most likely get your attention. That said, each version of VS has progressively improved the performance of the build process, so you should interpret the performance as a relation between build and rebuild, rather than as a statement about VS compared to any other tool.
Cleaning Solutions/Projects
A clean operation will delete project outputs, which include *.dll, *.exe, or other items produced by the build process. You would often perform a clean operation to guarantee that all outputs are fresh or to obtain a smaller copy of the project.