BlackWaspTM

This web site uses cookies. By using the site you accept the cookie policy.This message is for compliance with the UK ICO law.

Debugging
VS 2003+

Visual Studio Debug and Release Modes

Software developed using the .NET framework can be compiled into assemblies in either debug or release mode. These two modes create executables and libraries that have important differences. This article describes the use and setting of these modes.

Release Mode

When an assembly is built in release mode, the compiler performs all available optimisations to ensure that the outputted executables and libraries execute as efficiently as possible. This mode should be used for completed and tested software that is to be released to end-users. The drawback of release mode is that whilst the generated code is usually faster and smaller, it is not accessible to debugging tools.

Debug Mode

Debug mode is used whilst developing software. When an assembly is compiled in debug mode, additional symbolic information is embedded and the code is not optimised. This means that the output of the compiler is generally larger, slower and less efficient. However, a debugger can be attached to the running program to allow the code to be stepped through whilst monitoring the values of internal variables.

Setting the Build Mode

The simplest way to change the build mode is using the solution configuration drop-down list on the standard Visual Studio toolbar. By default, this shows three options, "Debug", "Release" and "Configuration Manager". Selecting either Debug or Release changes the build mode for all projects in the solution.

Using the Configuration Manager

The third option in the solution configuration drop-down list is "Configuration Manager". When selected, the Configuration Manager dialog box is displayed:

Configuration Manager

The configuration manager dialog box allows selection of the current build mode using the main drop-down list. In addition to selecting between Debug and Release, it is possible to create new configurations for your solution. To do so, choose "<New...>" from the main drop-down list. Once you have provided a name for your new configuration, you can individually set the build mode for each project in the solution using the grid. You can also select your preferred output platform and indicate if the individual projects should be compiled or not.

The new configuration is saved when the dialog box is closed. Afterwards you can select your newly named configuration using the standard toolbar options.

15 July 2008