共用方式為


How to: Set Debug and Release Configurations

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Visual Studio projects have separate release and debug configurations for your program. As the names imply, you build the debug version for debugging and the release version for the final release distribution.

The debug configuration of your program is compiled 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 contains no symbolic debug information and is fully optimized. Debug information can be generated in PDB Files, depending on the compiler options that are used. Creating PDB files can be very useful if you later have to debug your release version.

For more information about build configurations, see Understanding Build Configurations.

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 Topics section below.

To change the build configuration

  1. From the Build menu: click Build / Configuration Manager, then select Debug or Release.

  2. On the toolbar, choose either Debug or Release from the Solution Configurations list box.

    toolbar build configuration

    This toolbar is not available in Express editions. You can use the Build Solution F6 and Start Debugging F5 menu items to choose the configuration.

See Also

Debugger Settings and Preparation
Project Settings for a C++ Debug Configuration
Project Settings for C# Debug Configurations
Project Settings for a Visual Basic Debug Configuration
How to: Create and Edit Configurations
Debug and Release Project Configurations