forked from dotnet/extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Directory.Build.targets
98 lines (81 loc) · 5.7 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
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<Import Project="$(MSBuildThisFileDirectory)\eng\MSBuild\Analyzers.targets" />
<Import Project="$(MSBuildThisFileDirectory)\eng\MSBuild\Packaging.targets" />
<Import Project="$(MSBuildThisFileDirectory)\eng\MSBuild\LegacySupport.targets" />
<Import Project="$(MSBuildThisFileDirectory)\eng\MSBuild\Shared.targets" />
<Import Project="$(MSBuildThisFileDirectory)\eng\MSBuild\Generators.targets" />
<Import Project="$(MSBuildThisFileDirectory)\eng\MSBuild\ProjectStaging.targets" />
<!-- Warning stuff -->
<PropertyGroup>
<MSBuildWarningsAsMessages>$(MSBuildWarningsAsMessages);NETSDK1138;MSB3270</MSBuildWarningsAsMessages>
<WarningLevel>5</WarningLevel>
<!-- This is false for local development, but set to true in the CI system -->
<TreatWarningsAsErrors Condition=" '$(TreatWarningsAsErrors)' == '' ">false</TreatWarningsAsErrors>
<!-- Prevent analyzer crashes from stopping things -->
<NoWarn>$(NoWarn);AD0001</NoWarn>
<!-- Experimental warnings are for customers, not for this repo -->
<NoWarn>$(NoWarn);EXTEXP0001;EXTEXP0002;EXTEXP0003;EXTEXP0004;EXTEXP0005;EXTEXP0006;EXTEXP0007;EXTEXP0008;EXTEXP0009;EXTEXP0010;EXTEXP0011;EXTEXP0012;EXTEXP0013;EXTEXP0014;EXTEXP0015;EXTEXP0016;EXTEXP0017</NoWarn>
<!-- Obsoletion warnings are for customers, not for this repo -->
<NoWarn>$(NoWarn);EXTOBS0001;</NoWarn>
<!-- NU5104: A stable release of a package should not have a prerelease dependency -->
<NoWarn>$(NoWarn);NU5104</NoWarn>
<NoWarn Condition="'$(GenerateDocumentationFile)' != 'true'">$(NoWarn);SA1600;SA0001</NoWarn>
<!-- Legacy targets do not support attributes for a nullable context thus suppressing null check warnings -->
<NoWarn Condition="'$(TargetFramework)' == 'net462' or '$(TargetFramework)' == 'netstandard2.0'">$(NoWarn);CA1062</NoWarn>
</PropertyGroup>
<ItemGroup Condition="('$(Stage)' == 'normal' OR '$(Stage)' == 'obsolete') AND '$(OutputType)' != 'Exe' AND '$(IsPackable)' == 'true' AND '$(Api)' != 'false'">
<AdditionalFiles Include="$(MSBuildProjectName).json" Visible="False" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<Target
Name="AddApiBaselineFilesToRoot"
Condition="('$(Stage)' == 'normal' OR '$(Stage)'=='obsolete') AND '$(OutputType)' != 'Exe' AND '$(IsPackable)' == 'true' AND '$(Api)' != 'false'"
BeforeTargets="BeforeCompile">
<WriteLinesToFile
File="$(MSBuildProjectName).json"
Lines=""
Condition="!Exists('$(MSBuildProjectName).json')" />
</Target>
<ItemGroup Condition="'$(Stage)' == 'dev' AND '$(OutputType)' != 'Exe' AND '$(Api)' != 'false'">
<AssemblyAttribute Include="System.Diagnostics.CodeAnalysis.ExperimentalAttribute">
<_Parameter1>$(StageDevDiagnosticId)</_Parameter1>
<_Parameter2>UrlFormat = "https://aka.ms/dotnet-extensions-warnings/{0}"</_Parameter2>
<_Parameter2_IsLiteral>true</_Parameter2_IsLiteral>
</AssemblyAttribute>
</ItemGroup>
<Target Name="AddInternalsVisibleToDynamicProxyGenAssembly2" BeforeTargets="BeforeCompile">
<ItemGroup Condition="'@(InternalsVisibleToDynamicProxyGenAssembly2->Count())' > 0">
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1 Condition="'$(SignArtifacts)' == 'true' ">DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7</_Parameter1>
<_Parameter1 Condition="'$(SignArtifacts)' != 'true' ">DynamicProxyGenAssembly2</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
</Target>
<Target Name="AddInternalsVisibleToTest" Condition="'$(BuildTests)'!='false'" BeforeTargets="BeforeCompile">
<ItemGroup Condition="'@(InternalsVisibleToTest->Count())' > 0">
<InternalsVisibleTo Include="%(InternalsVisibleToTest.Identity)" />
</ItemGroup>
</Target>
<Target Name="_ConfigureTestRunnerAdditionalArguments" BeforeTargets="_InnerGetTestsToRun">
<PropertyGroup>
<!-- See https://learn.microsoft.com/dotnet/core/tools/dotnet-test -->
<_BlameArgs>--blame --blame-crash --blame-crash-dump-type full --blame-hang --blame-hang-dump-type full --blame-hang-timeout 6m</_BlameArgs>
<!-- This property is used by the Arcade SDK while bootstrapping the VS Test runner -->
<TestRunnerAdditionalArguments>$(TestRunnerAdditionalArguments) $(_BlameArgs)</TestRunnerAdditionalArguments>
</PropertyGroup>
</Target>
<!-- This target will make sure that projects targeting net462 will also have the Microsoft.Extensions.Logging.Abstractions analyzer removed. -->
<Target Name="_Microsoft_Extensions_Logging_AbstractionsRemoveAnalyzers"
Condition="'$(DisableMicrosoftExtensionsLoggingSourceGenerator)' == 'true'"
AfterTargets="ResolveReferences">
<ItemGroup>
<_Microsoft_Extensions_Logging_AbstractionsAnalyzer Include="@(Analyzer)" Condition="'%(Analyzer.NuGetPackageId)' == 'Microsoft.Extensions.Logging.Abstractions' Or
('%(Analyzer.AssemblyName)' == 'Microsoft.Extensions.Logging.Generators' and '%(Analyzer.NuGetPackageId)' == 'Microsoft.AspNetCore.App.Ref')" />
</ItemGroup>
<!-- Remove Microsoft.Extensions.Logging.Abstractions Analyzer -->
<ItemGroup>
<Analyzer Remove="@(_Microsoft_Extensions_Logging_AbstractionsAnalyzer)" />
</ItemGroup>
</Target>
</Project>