-
Notifications
You must be signed in to change notification settings - Fork 469
/
Copy pathDirectory.Build.props
69 lines (60 loc) · 3.38 KB
/
Directory.Build.props
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
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. -->
<Project>
<Import Project="..\Directory.Build.props"/>
<PropertyGroup>
<!-- Enable flow-analysis feature flag (can be removed when we move to Microsoft.CodeAnalysis 3.0 or larger) -->
<Features>$(Features);flow-analysis</Features>
<DefineConstants Condition="'$(LEGACY_CODE_METRICS_MODE)' == 'true'">$(DefineConstants),LEGACY_CODE_METRICS_MODE</DefineConstants>
</PropertyGroup>
<!-- Test runner configuration -->
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)Common\Test\App.config" CopyToOutputDirectory="PreserveNewest" Condition="'$(IsUnitTestProject)' == 'true'" />
</ItemGroup>
<Choose>
<When Condition="'$(DotNetBuildFromSource)' == 'true'">
<!-- Disable code analysis for source build -->
<PropertyGroup>
<EnableNETAnalyzers>false</EnableNETAnalyzers>
</PropertyGroup>
</When>
<Otherwise>
<!-- Default build configuration -->
<!-- Code analyzers -->
<PropertyGroup>
<!-- Enable all the latest CA rules from 'Microsoft.CodeAnalysis.NetAnalyzers' as build warnings by default. Specific rules are disabled or downgraded in repo's editorconfig. -->
<AnalysisLevel>latest</AnalysisLevel>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
<!-- Do not automatically include PerformanceSensitiveAttribute. It will be included manually. -->
<GeneratePerformanceSensitiveAttribute>false</GeneratePerformanceSensitiveAttribute>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="$(DogfoodNetAnalyzersVersion)" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="$(MicrosoftCodeAnalysisAnalyzersVersion)" />
<PackageReference Include="Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers" Version="$(MicrosoftCodeAnalysisPerformanceSensitiveAnalyzersVersion)" />
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="$(MicrosoftCodeAnalysisPublicApiAnalyzersVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="$(MicrosoftVisualStudioThreadingAnalyzersVersion)" />
<PackageReference Include="Roslyn.Diagnostics.Analyzers" Version="$(RoslynDiagnosticsAnalyzersVersion)" />
</ItemGroup>
<!-- Code Style analyzers -->
<ItemGroup Condition="'$(Language)' == 'C#'">
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="$(CodeStyleAnalyersVersion)" />
</ItemGroup>
<ItemGroup Condition="'$(Language)' == 'VB'">
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.CodeStyle" Version="$(CodeStyleAnalyersVersion)" />
</ItemGroup>
</Otherwise>
</Choose>
<!-- Setup the correct code analysis rulesets -->
<Choose>
<When Condition="'$(IsTestProject)' == 'true' or '$(NonShipping)' == 'true'">
<PropertyGroup>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)..\eng\Analyzers_NonShippingRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)..\eng\Analyzers_ShippingRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
</Otherwise>
</Choose>
</Project>