-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathDirectory.Build.targets
More file actions
122 lines (105 loc) · 7.09 KB
/
Directory.Build.targets
File metadata and controls
122 lines (105 loc) · 7.09 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<Project>
<PropertyGroup>
<!--
Disable nullable warnings when targeting anything other than our supported .NET core version(s).
This condition will be evaluated multiple times in multi-targeted projects hence need to be careful
to only set in the inner builds, not the outer build where only $(TargetFrameworks) is defined.
We still check $(TargetFrameworks) for empty though, because for single-targeted builds we want to
allow nullable warnings regardless of target framework.
-->
<NoWarn Condition="'$(TargetFrameworks)' != '' AND '$(TargetFramework)' != '' AND '$(TargetFrameworkIdentifier)' != '.NETCoreApp'">$(NoWarn);Nullable</NoWarn>
</PropertyGroup>
<ItemGroup>
<SupportedPlatform Remove="Android" />
<SupportedPlatform Remove="iOS" />
</ItemGroup>
<ItemGroup>
<!--
The System.Threading.Tasks global import interferes with Microsoft.Build.Utilities.Task that is used extensively
in this repository. Remove it to avoid the conflict.
-->
<Import Remove="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup Condition="'$(IsTestProject)' == 'true' AND '$(OutputType)' == 'Exe' AND '$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
<PackageReference Include="xunit.console" Private="true" />
<!-- These files are both included via a .props file in xunit.runner.visualstudio, as well as
via package dependencies of xunit.console. To prevent warnings about duplicate files
from Pack, don't copy the ones from the .props file to the output directory. -->
<None Update="@(None)">
<CopyToOutputDirectory Condition="'%(Filename)' == 'xunit.runner.utility.netcoreapp10'">false</CopyToOutputDirectory>
<CopyToOutputDirectory Condition="'%(Filename)' == 'xunit.runner.reporters.netcoreapp10'">false</CopyToOutputDirectory>
</None>
<!-- These files are included by the Microsoft.TestPlatform.TestHost package, but we don't want them in the .NET Tool NuGet package
(by default they would go in the content and contentFiles folders, generating NU5100 warnings. -->
<Content Update="@(Content)">
<Pack Condition="$([System.IO.Path]::GetFileName('%(Identity)')) == 'testhost.exe'">false</Pack>
<Pack Condition="$([System.IO.Path]::GetFileName('%(Identity)')) == 'testhost.dll'">false</Pack>
</Content>
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<!-- Update KnownFrameworkReferences to target the right version of the runtime -->
<!-- Don't use live shims when building tool packs in .NET product build mode as only packages for the current arch are available. -->
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'
and $(MicrosoftNETCoreAppRefPackageVersion.StartsWith('$(_TargetFrameworkVersionWithoutV)'))
and '$(MSBuildProjectName)' != 'sdk-tasks'
and '$(MSBuildProjectName)' != 'GenerateDocumentationAndConfigFiles'
and ('$(DotNetBuild)' != 'true' or '$(PackAsToolShimRuntimeIdentifiers)' == '')">
<FrameworkReference
Update="Microsoft.NETCore.App"
TargetingPackVersion="$(MicrosoftNETCoreAppRefPackageVersion)"
RuntimeFrameworkVersion="$(MicrosoftNETCoreAppRuntimePackageVersion)" />
<KnownILCompilerPack Update="Microsoft.DotNet.ILCompiler"
ILCompilerPackVersion="$(MicrosoftNETCoreAppRuntimePackageVersion)" />
<KnownCrossgen2Pack Update="Microsoft.NETCore.App.Crossgen2"
Crossgen2PackVersion="$(MicrosoftNETCoreAppRuntimePackageVersion)" />
</ItemGroup>
<ItemGroup Condition="$(MicrosoftAspNetCoreAppRefPackageVersion.StartsWith('$(_TargetFrameworkVersionWithoutV)'))">
<KnownFrameworkReference Update="Microsoft.AspNetCore.App">
<LatestRuntimeFrameworkVersion>$(MicrosoftAspNetCoreAppRefPackageVersion)</LatestRuntimeFrameworkVersion>
<RuntimePackRuntimeIdentifiers>$(SupportedRuntimeIdentifiers)</RuntimePackRuntimeIdentifiers>
<TargetingPackVersion>$(MicrosoftAspNetCoreAppRefPackageVersion)</TargetingPackVersion>
<DefaultRuntimeFrameworkVersion>$(MicrosoftAspNetCoreAppRefPackageVersion)</DefaultRuntimeFrameworkVersion>
</KnownFrameworkReference>
</ItemGroup>
<!--
Common content for all SDK source packages.
-->
<PropertyGroup Condition="'$(IsSourcePackage)' == 'true'">
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);_AddEditorConfigToSourcePackage;_AddLinkedCompileItemsToSourcePackage</TargetsForTfmSpecificContentInPackage>
<PackageDescription>
$(PackageDescription)
The source code included in this package is subject to arbitrary changes in future versions.
Updating a reference to this package to a newer version of the package may require changes in the referencing project.
No compatibility guarantees are provided.
</PackageDescription>
</PropertyGroup>
<!-- Include SourcePackage.editorconfig in all source packages. -->
<Target Name="_AddEditorConfigToSourcePackage">
<ItemGroup>
<TfmSpecificPackageFile Include="$(MSBuildThisFileDirectory)eng\SourcePackage.editorconfig" PackagePath="contentFiles/cs/$(TargetFramework)/.editorconfig" Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'" />
<TfmSpecificPackageFile Include="$(MSBuildThisFileDirectory)eng\SourcePackage.netstandard.editorconfig" PackagePath="contentFiles/cs/$(TargetFramework)/.editorconfig" Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard'" />
<TfmSpecificPackageFile Include="$(MSBuildThisFileDirectory)eng\SourcePackage.netframework.editorconfig" PackagePath="contentFiles/cs/$(TargetFramework)/.editorconfig" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" />
</ItemGroup>
</Target>
<!-- Include linked files. Arcade SDK only includes files in the project directory. -->
<Target Name="_AddLinkedCompileItemsToSourcePackage">
<ItemGroup>
<TfmSpecificPackageFile Include="@(Compile)" Condition="'%(Compile.Link)' != '' and '%(Compile.Pack)' != 'false'" PackagePath="contentFiles/cs/$(TargetFramework)/%(Compile.Link)" BuildAction="Compile"/>
</ItemGroup>
</Target>
<!-- Diagnostic target for verifying platform property resolution -->
<Target Name="ShowPlatformProperties"
BeforeTargets="Build"
Condition="'$(ShowPlatformProperties)' == 'true'">
<Message Importance="high" Text="HostOS = $(HostOS)" />
<Message Importance="high" Text="TargetOS = $(TargetOS)" />
<Message Importance="high" Text="OSName = $(OSName)" />
<Message Importance="high" Text="BuildArchitecture = $(BuildArchitecture)" />
<Message Importance="high" Text="TargetArchitecture = $(TargetArchitecture)" />
<Message Importance="high" Text="TargetRid = $(TargetRid)" />
<Message Importance="high" Text="TargetsWindows = $(TargetsWindows)" />
<Message Importance="high" Text="TargetsLinux = $(TargetsLinux)" />
<Message Importance="high" Text="TargetsOSX = $(TargetsOSX)" />
<Message Importance="high" Text="TargetsUnix = $(TargetsUnix)" />
</Target>
</Project>