Tuesday, May 25, 2021

Visual Studio Build, Rebuild and Clean Commands

When an application is developed, different items/files/components are used in the development process. The items are compiled to created EXE or DLL file. Now, there are two cases.
  1. To compile and build only items in which changes have occurred
  2. To compile and build all items of the application regardless of whether changes have occurred in an item or not.
Build: The Build command builds those items/files of project in which changes have been made. Due to Build command, the EXE file or DLL file Date Modified attribute is affected if changes have occurred in the project. We can verify it by looking into the bin/debug folder. The Build or Build Solution command compiles only those project files and components that have changed since the most recent build. For example, if you press CTRL+SHIFT+B, project is built but if without making changes in the project files, we again press CTRL+SHIFT+B, then no changes occurs in the EXE or DLL assembly file. We can notice it by looking at the Date Modified attribute of the EXE file. The changes in application is reflected in the EXE file's Date Modified attribute.

The EXE file is affected if there is any change in the application. The change in Date Modified of the EXE file implies that there was any change in the application when the Build command was executed. 
 

Clean: The Clean or Clean Solution command deletes any intermediate and output files. With only the project and component files left, new instances of the intermediate and output files can then be built. The Clean command cleans the files built after the compilation. We can verify it by looking into the bin/debug folder. It is shown below.
The status of bin/debug folder after Clean command:

Rebuild: The rebuild command is combination of Clean and Build commands. The Clean command cleans the previously compiled items/files and then items are rebuilt from the scratch.

We find the following status of EXE and other files in the bin/debug folder.




No comments:

Post a Comment

Hot Topics