-
Notifications
You must be signed in to change notification settings - Fork 36
/
Directory.Build.targets
35 lines (29 loc) · 1.39 KB
/
Directory.Build.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
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<PropertyGroup Label="Analyzers Log Output">
<AnalyzersLogDirectory Condition="'$(AnalyzersLogDirectory)'==''">$(IntermediateOutputPath)\CodeAnalysisLogs\</AnalyzersLogDirectory>
<ErrorLog>$(AnalyzersLogDirectory)\$(MSBuildProjectName).sarif</ErrorLog>
<AnalyzersLog>$(AnalyzersLogDirectory)\$(MSBuildProjectName).analyzers</AnalyzersLog>
</PropertyGroup>
<PropertyGroup Label="Documentation">
<GenerateDocumentationFile Condition="'$(IsTestProject)'!='true'">true</GenerateDocumentationFile>
</PropertyGroup>
<Target Name="CreateDirectories" BeforeTargets="CoreCompile">
<MakeDir Directories="$(AnalyzersLogDirectory)"/>
</Target>
<!-- In addition to the sarif output, also log the referenced analyzer dlls and the ruleset file path -->
<Target Name="LogStaticAnalysisConfig" AfterTargets="CoreCompile">
<ItemGroup>
<Lines Include="Using ruleset file: $(ResolvedCodeAnalysisRuleSet)" />
<Lines Include="Using analyzer assemblies:" />
<Lines Include="@(Analyzer->' %(fullpath)')" />
</ItemGroup>
<WriteLinesToFile
File="$(AnalyzersLog)"
Lines="@(Lines)"
Overwrite="true"
Encoding="Unicode" />
</Target>
</Project>