Skip to content

Commit 890a031

Browse files
Use Microsoft.CodeAnalysis.NetAnalyzers (#7395)
* Use Microsoft.CodeAnalysis.NetAnalyzers Contributes to #2033 * Handle new warnings
1 parent 09608ab commit 890a031

File tree

10 files changed

+1765
-61
lines changed

10 files changed

+1765
-61
lines changed

eng/Versions.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@
7777
<StrawberryPerlVersion>5.28.1.1-1</StrawberryPerlVersion>
7878
<NetFramework48RefAssembliesVersion>0.0.0.1</NetFramework48RefAssembliesVersion>
7979
</PropertyGroup>
80+
<!-- External Analyzers -->
81+
<PropertyGroup>
82+
<MicrosoftCodeAnalysisNetAnalyzersVersion>7.0.0</MicrosoftCodeAnalysisNetAnalyzersVersion>
83+
</PropertyGroup>
8084
<!--Package names-->
8185
<PropertyGroup>
8286
<SystemReflectionMetadataLoadContextPackage>System.Reflection.MetadataLoadContext</SystemReflectionMetadataLoadContextPackage>

eng/WpfArcadeSdk/Sdk/Sdk.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
<Import Project="$(WpfArcadeSdkToolsDir)ApiCompat.props" />
4545
<Import Project="$(WpfArcadeSdkToolsDir)GenApi.props" />
4646
<Import Project="$(WpfArcadeSdkToolsDir)Publishing.props" />
47+
<Import Project="$(WpfArcadeSdkToolsDir)CodeAnalysis.props" />
4748

4849
<PropertyGroup>
4950
<DebugType>full</DebugType>
Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
<Project>
22

33
<PropertyGroup>
4-
<CodeAnalysisRuleset Condition="'$(IsTestProject)'!='true' AND '$(EnableAnalyzers)'=='true'">$(MSBuildThisFileDirectory)CodeAnalysis\WpfCodeAnalysis.ruleset</CodeAnalysisRuleset>
4+
<!-- Do not warn about the version of analyzers being used in this project -->
5+
<_SkipUpgradeNetAnalyzersNuGetWarning>true</_SkipUpgradeNetAnalyzersNuGetWarning>
56
</PropertyGroup>
67

7-
<ItemGroup Condition="'$(IsTestProject)'!='true' AND '$(EnableAnalyzers)'=='true'">
8-
<!-- Managed Code Reference analyzers -->
9-
<PackageReference Include="Microsoft.DotNet.CodeAnalysis" Version="$(MicrosoftDotNetCodeAnalysisPackageVersion)" />
10-
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="2.9.0" />
11-
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.3" />
12-
<PackageReference Include="System.Runtime.Analyzers" Version="1.1.0" />
13-
<PackageReference Include="System.Runtime.InteropServices.Analyzers" Version="1.1.0" />
14-
</ItemGroup>
15-
</Project>
8+
</Project>

eng/WpfArcadeSdk/tools/CodeAnalysis.targets

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
<Project>
2-
<PropertyGroup>
3-
<CodeAnalysisRuleSet Condition="'$(IsTestProject)'!='true' AND '$(EnableAnalyzers)'=='true'">$(MSBuildThisFileDirectory)CodeAnalysis\WpfCodeAnalysis.ruleset</CodeAnalysisRuleSet>
4-
</PropertyGroup>
5-
62
<ItemGroup Condition="'$(IsTestProject)'!='true' AND '$(EnableAnalyzers)'=='true'">
3+
<EditorConfigFiles Include="$(MSBuildThisFileDirectory)CodeAnalysis\CodeAnalysis.src.globalconfig" />
74
<!-- Managed Code Reference analyzers -->
85
<PackageReference Include="Microsoft.DotNet.CodeAnalysis" Version="$(MicrosoftDotNetCodeAnalysisPackageVersion)" />
9-
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.1" />
6+
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="$(MicrosoftCodeAnalysisNetAnalyzersVersion)" PrivateAssets="all" />
107
<PackageReference Include="System.Runtime.Analyzers" Version="1.1.0" />
118
<PackageReference Include="System.Runtime.InteropServices.Analyzers" Version="1.1.0" />
129
</ItemGroup>

0 commit comments

Comments
 (0)