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
-**Deterministic** / `-deterministic`: Produce byte-for-byte equivalent output from the same input source.
20
20
-**ProduceOnlyReferenceAssembly** / `-refonly`: Produce a reference assembly, instead of a full assembly, as the primary output.
21
21
22
22
## DebugType
23
23
24
-
The **DebugType** option causes the compiler to generate debugging information and place it in the output file or files. This may be affected by the selected build configuration: *Debug* or *Release*.
24
+
The **DebugType** option causes the compiler to generate debugging information and place it in the output file or files. Debugging information may be affected by the selected build configuration: *Debug* or *Release*.
25
25
26
26
```xml
27
27
<DebugType>Full</DebugType>
28
28
```
29
29
30
-
The value of this element can be either `full` or `pdbonly`. The *full* argument, which is in effect if you do not specify *pdbonly*, enables attaching a debugger to the running program. Specifying *pdbonly* allows source code debugging when the program is started in the debugger but will only display assembler when the running program is attached to the debugger. Use this option to create debug builds. If **-debug**, **-debug+**, or **-debug:full**is not specified, you will not be able to debug the output file of your program. If you use *full*, be aware that there is some impact on the speed and size of JIT optimized code and a small impact on code quality with *full*. We recommend *pdbonly* or no PDB for generating release code.
30
+
The value of this element can be either `full` or `pdbonly`. The *full* argument, which is in effect if you don't specify *pdbonly*, enables attaching a debugger to the running program. Specifying *pdbonly* allows source code debugging when the program is started in the debugger but will only display assembler when the running program is attached to the debugger. Use this option to create debug builds. If **-debug**, **-debug+**, or **-debug:full**isn't specified, you can't debug the output file of your program. If you use *full*, be aware that there's some impact on the speed and size of JIT optimized code and a small impact on code quality with *full*. We recommend *pdbonly* or no PDB for generating release code.
31
31
32
32
> [!NOTE]
33
33
> One difference between *pdbonly* and *full* is that with *full* the compiler emits a <xref:System.Diagnostics.DebuggableAttribute>, which is used to tell the JIT compiler that debug information is available. Therefore, you will get an error if your code contains the <xref:System.Diagnostics.DebuggableAttribute> set to false if you use *full*.
34
34
35
-
For more information on how to configure the debug performance of an application, see [Making an Image Easier to Debug](../../../framework/debug-trace-profile/making-an-image-easier-to-debug.md). To change the location of the .pdb file, see [**PdbFile**](./advanced.md#pdbfile).
35
+
For more information on how to configure the debug performance of an application, see [Making an Image Easier to Debug](../../../framework/debug-trace-profile/making-an-image-easier-to-debug.md). To change the location of the *.pdb* file, see [**PdbFile**](./advanced.md#pdbfile).
36
36
37
37
## Optimize
38
38
@@ -76,7 +76,7 @@ By default, compiler output from a given set of inputs is unique, since the comp
76
76
- The Common Language Runtime (CLR) platform on which the compiler is run.
77
77
- The value of `%LIBPATH%`, which can affect analyzer dependency loading.
78
78
79
-
Deterministic compilation can be used for establishing whether a binary is compiled from a trusted source. This can be useful when the source is publicly available. It can also determine whether build steps that are dependent on changes to binary used in the build process.
79
+
Deterministic compilation can be used for establishing whether a binary is compiled from a trusted source. Deterministic output can be useful when the source is publicly available. It can also determine whether build steps that are dependent on changes to binary used in the build process.
Copy file name to clipboardExpand all lines: docs/csharp/language-reference/compiler-options/errors-warnings.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,13 +29,13 @@ The following options control how the compiler reports errors and warnings. The
29
29
30
30
## TreatWarningsAsErrors
31
31
32
-
The **TreatWarningsAsErrors** option treats all warnings as errors. You can also use the **WarningsAsError** to set only some warnings as errors. If you turn on **TreatWarningsAsErrors**, you can use **WarningsNotAsError** to list warnings that should not be treated as errors.
32
+
The **TreatWarningsAsErrors** option treats all warnings as errors. You can also use the **WarningsAsError** to set only some warnings as errors. If you turn on **TreatWarningsAsErrors**, you can use **WarningsNotAsError** to list warnings that shouldn't be treated as errors.
33
33
34
34
```xml
35
35
<TreatWarningsAsErrors></TreatWarningsAsErrors>
36
36
```
37
37
38
-
Any messages that would ordinarily be reported as warnings are instead reported as errors, and the build process is halted (no output files are built). By default, **TreatWarningsAsErrors** isn't in effect, which means warnings don't prevent the generation of an output file. Optionally, if you want only a few specific warnings to be treated as errors, you may specify a comma-separated list of warning numbers to treat as errors. The set of all nullability warnings can be specified with the **Nullable** shorthand. Use **WarningLevel** to specify the level of warnings that you want the compiler to display. Use **DisabledWarnings** to disable certain warnings.
38
+
All warning messages are instead reported as errors. The build process halts (no output files are built). By default, **TreatWarningsAsErrors** isn't in effect, which means warnings don't prevent the generation of an output file. Optionally, if you want only a few specific warnings to be treated as errors, you may specify a comma-separated list of warning numbers to treat as errors. The set of all nullability warnings can be specified with the **Nullable** shorthand. Use **WarningLevel** to specify the level of warnings that you want the compiler to display. Use **DisabledWarnings** to disable certain warnings.
39
39
40
40
## WarningLevel
41
41
@@ -45,7 +45,7 @@ The **WarningLevel** option specifies the warning level for the compiler to disp
45
45
<WarningLevel>3</WarningLevel>
46
46
```
47
47
48
-
The element value is the warning level you want displayed for the compilation: Lower numbers show only high severity warnings; higher numbers show more warnings. The value must be zero or a positive integer:
48
+
The element value is the warning level you want displayed for the compilation: Lower numbers show only high severity warnings. Higher numbers show more warnings. The value must be zero or a positive integer:
49
49
50
50
|Warning level|Meaning|
51
51
|-------------------|-------------|
@@ -67,7 +67,7 @@ The **DisabledWarnings** option lets you suppress the compiler from displaying o
`number1`, `number2` Warning number(s) that you want the compiler to suppress. You should only specify the numeric part of the warning identifier. For example, if you want to suppress *CS0028*, you could specify `<DisabledWarnings>28</DisabledWarnings>`. The compiler will silently ignore warning numbers passed to **DisabledWarnings** that were valid in previous releases, but that have been removed from the compiler. For example, *CS0679* was valid in the compiler in Visual Studio .NET 2002 but was subsequently removed.
70
+
`number1`, `number2` Warning number(s) that you want the compiler to suppress. You specify the numeric part of the warning identifier. For example, if you want to suppress *CS0028*, you could specify `<DisabledWarnings>28</DisabledWarnings>`. The compiler silently ignores warning numbers passed to **DisabledWarnings** that were valid in previous releases, but that have been removed. For example, *CS0679* was valid in the compiler in Visual Studio .NET 2002 but was removed later.
71
71
72
72
The following warnings cannot be suppressed by the **DisabledWarnings** option:
73
73
@@ -83,7 +83,7 @@ Specify a ruleset file that configures specific diagnostics.
Where `MyConfiguration.ruleset` is the path to the ruleset file. For more information on using rule sets set the article in the [Visual Studio documentation on Rule sets](visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules).
86
+
Where `MyConfiguration.ruleset` is the path to the ruleset file. For more information on using rule sets, see the article in the [Visual Studio documentation on Rule sets](visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules).
87
87
88
88
## ErrorLog
89
89
@@ -93,7 +93,7 @@ Specify a file to log all compiler and analyzer diagnostics.
93
93
<ErrorLog>MyConfiguration.ruleset</ErrorLog>
94
94
```
95
95
96
-
This causes the compiler to output a [Static Analysis Results Interchange Format (SARIF) log](https://github.com/microsoft/sarif-tutorials/blob/main/docs/1-Introduction.md#:~:text=What%20is%20SARIF%3F,for%20use%20by%20simpler%20tools) as a part of the build. SARIF logs are typically read by other tools that analyze the results from compiler and analyzer diagnostics.
96
+
The **ErrorLog** option causes the compiler to output a [Static Analysis Results Interchange Format (SARIF) log](https://github.com/microsoft/sarif-tutorials/blob/main/docs/1-Introduction.md#:~:text=What%20is%20SARIF%3F,for%20use%20by%20simpler%20tools). SARIF logs are typically read by tools that analyze the results from compiler and analyzer diagnostics.
97
97
98
98
## ReportAnalyzer
99
99
@@ -103,4 +103,4 @@ Report additional analyzer information, such as execution time.
103
103
<ReportAnalyzer>true</ReportAnalyzer>
104
104
```
105
105
106
-
The **ReportAnalyzer**options causes the compiler to emit extra MSBuild log information that details the performance characteristics of analyzers in the build. It is typically used by analyzer authors as part of validating the analyzer.
106
+
The **ReportAnalyzer**option causes the compiler to emit extra MSBuild log information that details the performance characteristics of analyzers in the build. It's typically used by analyzer authors as part of validating the analyzer.
This section describes the options interpreted by the C# compiler. There are two different ways to set compiler options in .NET projects:
18
18
19
-
-***Specify option in your \*.csproj file***: You can add XML elements for any compiler option in your *\*.csproj* file. The element name is the same as the compiler option. The value of the XML element sets the value of the compiler option. For more details on setting options in project files see the article [MSBuild properties for .NET SDK Projects](../../../core/project-sdk/msbuild-props.md).
19
+
-***Specify option in your \*.csproj file***: You can add XML elements for any compiler option in your *\*.csproj* file. The element name is the same as the compiler option. The value of the XML element sets the value of the compiler option. For more information on setting options in project files, see the article [MSBuild properties for .NET SDK Projects](../../../core/project-sdk/msbuild-props.md).
20
20
-***Using the Visual Studio Property pages***: Visual Studio provides property pages to edit build properties. You can learn more about them see the article [Manage project and solution properties - Windows](https://docs.microsoft.com/visualstudio/ide/managing-project-and-solution-properties#c-visual-basic-and-f-projects) or [Manage project and solution properties - Mac](https://docs.microsoft.com/visualstudio/mac/managing-solutions-and-project-properties).
0 commit comments