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/core/project-sdk/msbuild-props.md
+16-20Lines changed: 16 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -932,15 +932,15 @@ The following MSBuild properties are documented in this section:
932
932
933
933
### AnalysisLevel
934
934
935
-
The `AnalysisLevel` property lets you specify a set of code analyzers to run according to a .NET release. Each .NET release, starting in .NET 5, has a set of code analysis rules. Of that set, the rules that are enabled by default for that release will analyze your code. For example, if you upgrade to .NET 8 but don't want the default set of code analysis rules to change, set `AnalysisLevel` to `7`.
935
+
The `AnalysisLevel` property lets you specify a set of code analyzers to run according to a .NET release. Each .NET releasehas a set of code analysis rules. Of that set, the rules that are enabled by default for that release analyze your code. For example, if you upgrade from .NET 8 to .NET 9 but don't want the default set of code analysis rules to change, set `AnalysisLevel` to `8`.
936
936
937
937
```xml
938
938
<PropertyGroup>
939
-
<AnalysisLevel>preview</AnalysisLevel>
939
+
<AnalysisLevel>8</AnalysisLevel>
940
940
</PropertyGroup>
941
941
```
942
942
943
-
Optionally, starting in .NET 6, you can specify a compound value for this property that also specifies how aggressively to enable rules. Compound values take the form `<version>-<mode>`, where the `<mode>` value is one of the [AnalysisMode](#analysismode) values. The following example uses the preview version of code analyzers, and enables the recommended set of rules.
943
+
Optionally, you can specify a compound value for this property that also specifies how aggressively to enable rules. Compound values take the form `<version>-<mode>`, where the `<mode>` value is one of the [AnalysisMode](#analysismode) values. The following example uses the `preview` version of code analyzers, and enables the `recommended` set of rules.
944
944
945
945
```xml
946
946
<PropertyGroup>
@@ -955,12 +955,16 @@ Default value:
955
955
956
956
The following table shows the values you can specify.
|`latest`| The latest code analyzers that have been released are used. This is the default. |
961
961
|`latest-<mode>`| The latest code analyzers that have been released are used. The `<mode>` value determines which rules are enabled. |
962
962
|`preview`| The latest code analyzers are used, even if they are in preview. |
963
963
|`preview-<mode>`| The latest code analyzers are used, even if they are in preview. The `<mode>` value determines which rules are enabled. |
964
+
|`9.0`| The set of rules that was available for the .NET 9 release is used, even if newer rules are available. |
965
+
|`9.0-<mode>`| The set of rules that was available for the .NET 9 release is used, even if newer rules are available. The `<mode>` value determines which rules are enabled. |
966
+
|`9`| The set of rules that was available for the .NET 9 release is used, even if newer rules are available. |
967
+
|`9-<mode>`| The set of rules that was available for the .NET 9 release is used, even if newer rules are available. The `<mode>` value determines which rules are enabled. |
964
968
|`8.0`| The set of rules that was available for the .NET 8 release is used, even if newer rules are available. |
965
969
|`8.0-<mode>`| The set of rules that was available for the .NET 8 release is used, even if newer rules are available. The `<mode>` value determines which rules are enabled. |
966
970
|`8`| The set of rules that was available for the .NET 8 release is used, even if newer rules are available. |
@@ -969,18 +973,10 @@ The following table shows the values you can specify.
969
973
|`7.0-<mode>`| The set of rules that was available for the .NET 7 release is used, even if newer rules are available. The `<mode>` value determines which rules are enabled. |
970
974
|`7`| The set of rules that was available for the .NET 7 release is used, even if newer rules are available. |
971
975
|`7-<mode>`| The set of rules that was available for the .NET 7 release is used, even if newer rules are available. The `<mode>` value determines which rules are enabled. |
972
-
|`6.0`| The set of rules that was available for the .NET 6 release is used, even if newer rules are available. |
973
-
|`6.0-<mode>`| The set of rules that was available for the .NET 6 release is used, even if newer rules are available. The `<mode>` value determines which rules are enabled. |
974
-
|`6`| The set of rules that was available for the .NET 6 release is used, even if newer rules are available. |
975
-
|`6-<mode>`| The set of rules that was available for the .NET 6 release is used, even if newer rules are available. The `<mode>` value determines which rules are enabled. |
976
-
|`5.0`| The set of rules that was available for the .NET 5 release is used, even if newer rules are available. |
977
-
|`5.0-<mode>`| The set of rules that was available for the .NET 5 release is used, even if newer rules are available. The `<mode>` value determines which rules are enabled. |
978
-
|`5`| The set of rules that was available for the .NET 5 release is used, even if newer rules are available. |
979
-
|`5-<mode>`| The set of rules that was available for the .NET 5 release is used, even if newer rules are available. The `<mode>` value determines which rules are enabled. |
980
976
981
977
> [!NOTE]
982
978
>
983
-
> -Starting in .NET 6, if you set [EnforceCodeStyleInBuild](#enforcecodestyleinbuild) to `true`, this property affects [code-style (IDEXXXX) rules](../../fundamentals/code-analysis/style-rules/index.md) (in addition to code-quality rules).
979
+
> -If you set [EnforceCodeStyleInBuild](#enforcecodestyleinbuild) to `true`, this property affects [code-style (IDEXXXX) rules](../../fundamentals/code-analysis/style-rules/index.md) (in addition to code-quality rules).
984
980
> - If you set a compound value for `AnalysisLevel`, you don't need to specify an [AnalysisMode](#analysismode). However, if you do, `AnalysisLevel` takes precedence over `AnalysisMode`.
985
981
> - This property has no effect on code analysis in projects that don't reference a [project SDK](overview.md), for example, legacy .NET Framework projects that reference the Microsoft.CodeAnalysis.NetAnalyzers NuGet package.
986
982
@@ -1002,8 +998,8 @@ This property is the same as [AnalysisLevel](#analysislevel), except that it onl
1002
998
1003
999
The following table lists the property name for each rule category.
@@ -1033,8 +1029,8 @@ The following table shows the available option values. They're listed in increas
1033
1029
1034
1030
> [!NOTE]
1035
1031
>
1036
-
> -Starting in .NET 6, if you set [EnforceCodeStyleInBuild](#enforcecodestyleinbuild) to `true`, this property affects [code-style (IDEXXXX) rules](../../fundamentals/code-analysis/style-rules/index.md) (in addition to code-quality rules).
1037
-
> - If you use a compound value for [AnalysisLevel](#analysislevel), for example, `<AnalysisLevel>8-recommended</AnalysisLevel>`, you can omit this property entirely. However, if you specify both properties, `AnalysisLevel` takes precedence over `AnalysisMode`.
1032
+
> -If you set [EnforceCodeStyleInBuild](#enforcecodestyleinbuild) to `true`, this property affects [code-style (IDEXXXX) rules](../../fundamentals/code-analysis/style-rules/index.md) (in addition to code-quality rules).
1033
+
> - If you use a compound value for [AnalysisLevel](#analysislevel), for example, `<AnalysisLevel>9-recommended</AnalysisLevel>`, you can omit this property entirely. However, if you specify both properties, `AnalysisLevel` takes precedence over `AnalysisMode`.
1038
1034
> - This property has no effect on code analysis in projects that don't reference a [project SDK](overview.md), for example, legacy .NET Framework projects that reference the Microsoft.CodeAnalysis.NetAnalyzers NuGet package.
1039
1035
1040
1036
### AnalysisMode\<Category>
@@ -1049,8 +1045,8 @@ This property is the same as [AnalysisMode](#analysismode), except that it only
1049
1045
1050
1046
The following table lists the property name for each rule category.
Copy file name to clipboardExpand all lines: docs/fundamentals/code-analysis/includes/analysis-model-levels.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
| Value | Description |
2
-
|-|-|
2
+
|-------|-------------|
3
3
|`None`| All rules are disabled. You can selectively [opt in to](../configuration-options.md) individual rules to enable them. |
4
4
|`Default`| Default mode, where certain rules are enabled as build warnings, certain rules are enabled as Visual Studio IDE suggestions, and the remainder are disabled. |
5
5
|`Minimum`| More aggressive mode than `Default` mode. Certain suggestions that are highly recommended for build enforcement are enabled as build warnings. To see which rules this includes, inspect the *%ProgramFiles%/dotnet/sdk/\[version]/Sdks/Microsoft.NET.Sdk/analyzers/build/config/analysislevel_\[level]_minimum.editorconfig* file. |
0 commit comments