You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Set debug and release configurations in Visual Studio
38
-
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.
39
-
40
-
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.
41
-
42
-
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](#BKMK_symbols_release) that are used. Creating .pdb files can be very useful if you later have to debug your release version.
43
-
44
-
For more information about build configurations, see [Understanding Build Configurations](../ide/understanding-build-configurations.md).
45
-
46
-
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 See Also section below.
47
-
48
-
## Change the build configuration
49
-
50
-
1. From the **Build** menu, select **Configuration Manager**, then select **Debug** or **Release**.
51
-
52
-
2. On the toolbar, choose either **Debug** or **Release** from the **Solution Configurations** list box.
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.
38
+
39
+
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.
40
+
41
+
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.
42
+
43
+
The release configuration of your program has no symbolic debug information and is fully optimized. Debug information can be generated in .pdb files, [depending on the compiler options](#BKMK_symbols_release) that are used. Creating .pdb files can be useful if you later have to debug your release version.
44
+
45
+
For more information about build configurations, see [Understand build configurations](../ide/understanding-build-configurations.md).
46
+
47
+
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 [See also](#see-also) section below.
48
+
49
+
## Change the build configuration
50
+
51
+
To change the build configuration, either:
52
+
53
+
* From the **Build** menu, select **Configuration Manager**, then select **Debug** or **Release**.
54
+
55
+
or
56
+
57
+
* On the toolbar, choose either **Debug** or **Release** from the **Solution Configurations** list.
## <aname="BKMK_symbols_release"></a>Generate symbol (.pdb) files for a build
59
62
60
-
For most project types, the .pdb files are generated by default for both debug and release builds, but the default settings are different depending on your specific project type and the version of Visual Studio. You can configure whether the compiler generates .pdb files and what kind of debug information to include.
63
+
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.
61
64
62
-
> [!IMPORTANT]
63
-
> The debugger will load only a .pdb file for an executable file that exactly matches the .pdb file that was created when the executable was built (that is, the .pdb must be the original or a copy of the original .pdb file). For more information see [Why does Visual Studio require debugger symbol files to exactly match the binary files that they were built with?](https://blogs.msdn.microsoft.com/jimgries/2007/07/06/why-does-visual-studio-require-debugger-symbol-files-to-exactly-match-the-binary-files-that-they-were-built-with/)
65
+
> [!IMPORTANT]
66
+
> The debugger will load only a .pdb file for an executable file that exactly matches the .pdb file that was created when the executable was built (that is, the .pdb must be the original or a copy of the original .pdb file). For more information, see [Why does Visual Studio require debugger symbol files to exactly match the binary files that they were built with?](https://blogs.msdn.microsoft.com/jimgries/2007/07/06/why-does-visual-studio-require-debugger-symbol-files-to-exactly-match-the-binary-files-that-they-were-built-with/)
64
67
65
68
Each project type may have a different way of setting these options.
66
69
67
70
### Generate symbol files for a C#, ASP.NET, or Visual Basic project
68
71
69
-
For detailed information on project settings for debug configurations in C#, see [Project settings for a C# Debug configuration](../debugger/project-settings-for-csharp-debug-configurations.md). For Visual Basic, see [this topic](../debugger/project-settings-for-a-visual-basic-debug-configuration.md).
72
+
For detailed information on project settings for debug configurations in C# or Visual Basic, see [Project settings for a C# debug configuration](../debugger/project-settings-for-csharp-debug-configurations.md) or [Project settings for a Visual Basic debug configuration](../debugger/project-settings-for-a-visual-basic-debug-configuration.md).
70
73
71
-
1.Right-click the project in Solution Explorer and choose **Properties**.
74
+
1.In Solution Explorer, select the project.
72
75
73
-
2.Choose a**Release** or **Debug** build from the **Configuration** list.
2. Choose **Build**settings and then click the **Advanced**button.
78
+
3. In the side pane, choose **Build**(or **Compile**in Visual Basic).
76
79
77
-
In Visual Basic, you choose the **Compile**settings and the **Advanced Compile Options**button instead.
80
+
4.In the **Configuration**list, choose **Debug**or **Release**.
78
81
79
-
3. Choose **full**,**portable**, or **pdb_only** in the **Debugging information** list box (**Generate debug info** in Visual Basic).
82
+
5. Select the**Advanced** button (or the **Advanced Compile Options** button in Visual Basic).
80
83
81
-
The portable format is the most recent cross-platform format for .NET Core. For more information on options, see [Advanced Build Settings dialog box (C#)](../ide/reference/advanced-build-settings-dialog-box-csharp.md).
84
+
6. In the **Debugging information** list (or the **Generate debug info** list in Visual Basic), choose **Full**, **Pdb-only**, or **Portable**.
82
85
83
-

86
+
The portable format is the most recent cross-platform format for .NET Core. For more information on options, see [Advanced Build Settings dialog box (C#)](../ide/reference/advanced-build-settings-dialog-box-csharp.md).
84
87
85
-
4. Build your project.
88
+

86
89
87
-
The symbol file(s) get created in the same folder as the executable or the main output file.
90
+
7. Build your project.
91
+
92
+
The compiler creates the symbol file(s) in the same folder as the executable or the main output file.
88
93
89
94
### Generate symbol files for a C++ project
90
95
91
-
1. Right-click the project in Solution Explorer and choose **Properties**.
96
+
1. In Solution Explorer, select the project.
97
+
98
+
2. Select the **Properties** icon (or press **Alt+Enter**).
99
+
100
+
3. In the **Configuration** list, choose **Debug** or **Release**.
92
101
93
-
2. Choose a **Release** or **Debug** build from the **Configuration** list.
102
+
4. In the side pane, choose **Linker > Debugging**, then select options for **Generate Debug Info**.
94
103
95
-
2. Under **Linker > Debugging**, select desired options for **Generate Debug Info**.
104
+
For detailed information on project settings for debug configurations in C++, see [Project settings for a C++ debug configuration](../debugger/project-settings-for-a-cpp-debug-configuration.md).
96
105
97
-
For detailed information on project settings for debug configurations in C++, see [Project settings for a C++ Debug configuration](../debugger/project-settings-for-a-cpp-debug-configuration.md).
106
+
5. Configure options for **Generate Program Database Files**.
98
107
99
-
4. Configure options for Generate Program Database Files
108
+
In most C++ projects, the default value is `$(OutDir)$(TargetName).pdb`, which generates .pdb files in the output folder.
100
109
101
-
In most C++ projects, the default value is `$(OutDir)$(TargetName).pdb`, which generates .pdb files in the output folder.
110
+

102
111
103
-

112
+
6. Build your project.
104
113
105
-
5. Build your project.
114
+
The compiler creates the symbol file(s) in the same folder as the executable or the main output file.
106
115
107
-
The symbol file(s) get created in the same folder as the executable or the main output file.
108
-
109
-
## See Also
110
-
[Specify symbol (.pdb) files and source files in the Visua Studio debugger](../debugger/debugger-settings-and-preparation.md)
111
-
[Debugger Settings and Preparation](../debugger/debugger-settings-and-preparation.md)
112
-
[Project Settings for a C++ Debug Configuration](../debugger/project-settings-for-a-cpp-debug-configuration.md)
113
-
[Project Settings for C# Debug Configurations](../debugger/project-settings-for-csharp-debug-configurations.md)
114
-
[Project Settings for a Visual Basic Debug Configuration](../debugger/project-settings-for-a-visual-basic-debug-configuration.md)
115
-
[How to: Create and Edit Configurations](../ide/how-to-create-and-edit-configurations.md)
116
+
## <aname="see-also"></a>See also
117
+
118
+
[Specify symbol (.pdb) files and source files in the Visual Studio debugger](../debugger/specify-symbol-dot-pdb-and-source-files-in-the-visual-studio-debugger.md)<br/>
119
+
[Debugger settings and preparation](../debugger/debugger-settings-and-preparation.md)<br/>
120
+
[Project settings for a C++ debug configuration](../debugger/project-settings-for-a-cpp-debug-configuration.md)<br/>
121
+
[Project settings for a C# debug configuration](../debugger/project-settings-for-csharp-debug-configurations.md)<br/>
122
+
[Project settings for a Visual Basic debug configuration](../debugger/project-settings-for-a-visual-basic-debug-configuration.md)<br/>
123
+
[How to: Create and edit configurations](../ide/how-to-create-and-edit-configurations.md)
0 commit comments