Set debug and release configurations in Visual Studio
Grein
Visual Studio projects have separate release and debug configurations for your program. You build the debug version for debugging and the release version for the final release distribution.
In debug configuration, your program compiles with full symbolic debug information and no optimization. Optimization complicates debugging, because the relationship between source code and generated instructions is more complex.
The release configuration of your program has no symbolic debug information and is fully optimized. For managed code and C++ code, debug information can be generated in .pdb files, depending on the compiler options that are used. Creating .pdb files can be useful if you later have to debug your release version.
You can change the build configuration from the Build menu, from the toolbar, or in the project's property pages. Project property pages are language-specific. The procedure below shows how to change the build configuration from the menu and the toolbar. For more information about how to change the build configuration in projects in different languages, see the Related content section below.
Change the build configuration
To change the build configuration, either:
On the toolbar, choose either Debug or Release from the Solution Configurations list.
or
From the Build menu, select Configuration Manager, then select Debug or Release.
Generate symbol (.pdb) files for a build (C#, C++, Visual Basic, F#)
You can choose to generate symbol (.pdb) files and what debug information to include. For most project types, the compiler generates symbol files by default for debug and release builds, while other default settings differ by project type and Visual Studio version.
Each project type may have a different way of setting these options.
Generate symbol files for a C# or ASP.NET Core project (.NET Core, .NET 5+ only)
For detailed information on project settings for debug configurations in C#, see Project settings for a C# debug configuration. (For .NET projects in Visual Basic, symbol files are configured the same as in .NET Framework.)
In Solution Explorer, right-click the project and choose Properties.
In the side pane, choose Build > General.
In the Optimize code section, choose Debug or Release.
In the Debug symbols list, choose PDB file, current platform, PBD file, portable, or Embedded.
This module explores the tools and processes used to debug C# console applications in Visual Studio Code. Hands-on activities provide experience using breakpoints, conditional breakpoints, and the debugging resources in the RUN AND DEBUG view.