-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
CodeAnalyzers.targets
76 lines (65 loc) · 3.23 KB
/
CodeAnalyzers.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<Project>
<!--
IDEALLY THIS IS ALWAYS ENABLED, BUT THAT TENDS TO HURT DEVELOPER PRODUCTIVITY
=============================================================================
<PropertyGroup Condition="'$(BuildingInsideVisualStudio)' != 'true'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
-->
<PropertyGroup>
<SolutionDir Condition="'$(SolutionDir)'==''">$(MSBuildThisFileDirectory)</SolutionDir>
</PropertyGroup>
<!-- Documentation-related settings -->
<PropertyGroup>
<!--
Make sure any documentation comments which are included in code get checked for syntax during the build, but do
not report warnings for missing comments.
CS1573: Parameter 'parameter' has no matching param tag in the XML comment for 'parameter' (but other parameters do)
CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member'
-->
<NoWarn>$(NoWarn),1573,1591,1712</NoWarn>
</PropertyGroup>
<!-- Analyzers-related configuration -->
<PropertyGroup>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
<RunAnalyzersDuringLiveAnalysis>true</RunAnalyzersDuringLiveAnalysis>
<AnalysisLevel>preview</AnalysisLevel>
<StyleCopTreatErrorsAsWarnings>true</StyleCopTreatErrorsAsWarnings>
<CodeAnalysisRuleSet Condition="Exists('$(SolutionDir)\stylecop.ruleset')">$(SolutionDir)\stylecop.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<!-- StyleCop Analyzer-related configuration -->
<AdditionalFiles Include="$(SolutionDir)\stylecop.json" Condition="Exists('$(SolutionDir)\stylecop.json')" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<None Remove="**\*.Cache" />
<!-- FxCop Analyzer-related configuration -->
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<!-- CodeCracker Analyzer-related configuration -->
<PackageReference Include="codecracker.CSharp" Version="1.1.*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<!-- Sonar Analyzer-related configuration -->
<PackageReference Include="SonarAnalyzer.CSharp" Version="[8.*, 9.0)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
<!--
Disable analyzers when building a project inside Visual Studio.
Note that analyzer behavior for IntelliSense purposes is not altered by this.
-->
<Target Name="DisableAnalyzersForVisualStudioBuild" BeforeTargets="CoreCompile"
Condition="'$(BuildingInsideVisualStudio)' == 'true' And '$(BuildingProject)' == 'true' And '$(Configuration)' == 'Debug'">
<ItemGroup>
<Analyzer Remove="@(Analyzer)"/>
</ItemGroup>
</Target>
</Project>