What is the difference between Release and Debug modes in Visual Studio?

Visual StudioVisual Studio-2005Conditional Compilation

Visual Studio Problem Overview


> Possible Duplicate:
> Debug vs. release in .NET
> Debug/Release difference

What is the difference between Release and Debug modes in Visual Studio while building a project?

Visual Studio Solutions


Solution 1 - Visual Studio

Debug and Release are just labels for different solution configurations. You can add others if you want. A project I once worked on had one called "Debug Internal" which was used to turn on the in-house editing features of the application. You can see this if you go to Configuration Manager... (it's on the Build menu). You can find more information on MSDN Library under Configuration Manager Dialog Box.

Each solution configuration then consists of a bunch of project configurations. Again, these are just labels, this time for a collection of settings for your project. For example, our C++ library projects have project configurations called "Debug", "Debug_Unicode", "Debug_MT", etc.

The available settings depend on what type of project you're building. For a .NET project, it's a fairly small set: #defines and a few other things. For a C++ project, you get a much bigger variety of things to tweak.

In general, though, you'll use "Debug" when you want your project to be built with the optimiser turned off, and when you want full debugging/symbol information included in your build (in the .PDB file, usually). You'll use "Release" when you want the optimiser turned on, and when you don't want full debugging information included.

Solution 2 - Visual Studio

Well, it depends on what language you are using, but in general they are 2 separate configurations, each with its own settings. By default, Debug includes debug information in the compiled files (allowing easy debugging) while Release usually has optimizations enabled.

As far as conditional compilation goes, they each define different symbols that can be checked in your program, but they are language-specific macros.

Solution 3 - Visual Studio

The main difference is when compiled in debug mode, pdb files are also created which allow debugging (so you can step through the code when its running). This however means that the code isn't optimized as much.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCuteView Question on Stackoverflow
Solution 1 - Visual StudioRoger LipscombeView Answer on Stackoverflow
Solution 2 - Visual StudioTal PressmanView Answer on Stackoverflow
Solution 3 - Visual StudioTetraneutronView Answer on Stackoverflow