-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathDirectory.Build.targets
More file actions
112 lines (97 loc) · 6.44 KB
/
Directory.Build.targets
File metadata and controls
112 lines (97 loc) · 6.44 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
<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'">
<!-- 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)" />
<KnownILLinkPack Update="Microsoft.NET.ILLink.Tasks"
ILLinkPackVersion="$(MicrosoftNETCoreAppRuntimePackageVersion)" />
<KnownWebAssemblySdkPack Update="Microsoft.NET.Sdk.WebAssembly.Pack"
WebAssemblySdkPackVersion="$(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)" />
</Target>
</Project>