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
Copy file name to clipboardExpand all lines: docs/csharp/language-reference/compiler-options/code-generation.md
+23-1Lines changed: 23 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,14 +24,35 @@ The following options control code generation by the compiler. The new MSBuild s
24
24
25
25
## DebugType
26
26
27
-
The **DebugType** option causes the compiler to generate debugging information and place it in the output file or files. Debugging information is added by default.
27
+
The **DebugType** option causes the compiler to generate debugging information and place it in the output file or files. The default value is `portable` for both Debug and Release build configurations, which means PDB files are generated by default for all configurations.
28
28
29
29
```xml
30
30
<DebugType>pdbonly</DebugType>
31
31
```
32
32
33
33
For all compiler versions starting with C# 6.0, there is no difference between *pdbonly* and *full*. Choose *pdbonly*. To change the location of the *.pdb* file, see [**PdbFile**](./advanced.md#pdbfile).
34
34
35
+
### Disabling PDB generation for Release builds
36
+
37
+
To suppress PDB file generation for Release builds while keeping them for Debug builds, add the following to your project file:
> In .NET 8 and later versions, setting `DebugSymbols` to `false` should suppress PDB generation according to the [breaking change documentation](../../../core/compatibility/sdk/8.0/debugsymbols.md). However, for the most reliable way to disable PDB generation, explicitly set `DebugType` to `none`.
55
+
35
56
The following values are valid:
36
57
37
58
| Value | Meaning |
@@ -40,6 +61,7 @@ The following values are valid:
40
61
|`pdbonly`| Same as `full`. See the note below for more information. |
41
62
|`portable`| Emit debugging information to .pdb file using cross-platform [Portable PDB](https://github.com/dotnet/designs/blob/main/accepted/2020/diagnostics/portable-pdb.md) format. |
42
63
|`embedded`| Emit debugging information into the _.dll/.exe_ itself (_.pdb_ file is not produced) using [Portable PDB](https://github.com/dotnet/designs/blob/main/accepted/2020/diagnostics/portable-pdb.md) format. |
64
+
|`none`| Don't produce a PDB file. |
43
65
44
66
> [!IMPORTANT]
45
67
> The following information applies only to compilers older than C# 6.0.
0 commit comments