forked from dotnet/aspnetcore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDirectory.Build.targets.in
171 lines (156 loc) · 11.5 KB
/
Directory.Build.targets.in
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<Project>
<PropertyGroup>
<!-- Workaround while there is no SDK available that understands the TFM; suppress unsupported version errors. -->
<NETCoreAppMaximumVersion>99.9</NETCoreAppMaximumVersion>
<UpdateAspNetCoreKnownFramework
Condition=" '$(UpdateAspNetCoreKnownFramework)' == '' ">true</UpdateAspNetCoreKnownFramework>
</PropertyGroup>
<!-- Workaround when there is no vNext SDK available; copy known apphost/framework reference info from 9.0. -->
<ItemGroup>
<KnownAppHostPack
Include="@(KnownAppHostPack->WithMetadataValue('TargetFramework', 'net9.0'))"
TargetFramework="${DefaultNetCoreTargetFramework}"
Condition="'@(KnownAppHostPack->Count())' != '0' AND
!(@(KnownAppHostPack->AnyHaveMetadataValue('TargetFramework', '${DefaultNetCoreTargetFramework}')))" />
<KnownRuntimePack
Include="@(KnownRuntimePack->WithMetadataValue('TargetFramework', 'net9.0'))"
TargetFramework="${DefaultNetCoreTargetFramework}"
Condition="'@(KnownRuntimePack->Count())' != '0' AND
!(@(KnownRuntimePack->AnyHaveMetadataValue('TargetFramework', '${DefaultNetCoreTargetFramework}')))" />
<KnownFrameworkReference
Include="@(KnownFrameworkReference->WithMetadataValue('TargetFramework', 'net9.0'))"
TargetFramework="${DefaultNetCoreTargetFramework}"
Condition="'@(KnownFrameworkReference->Count())' != '0' AND
!(@(KnownFrameworkReference->AnyHaveMetadataValue('TargetFramework', '${DefaultNetCoreTargetFramework}')))" />
<KnownILLinkPack
Include="@(KnownILLinkPack->WithMetadataValue('TargetFramework', 'net9.0'))"
TargetFramework="${DefaultNetCoreTargetFramework}"
Condition="'@(KnownILLinkPack->Count())' != '0' AND
!(@(KnownILLinkPack->AnyHaveMetadataValue('TargetFramework', '${DefaultNetCoreTargetFramework}')))" />
<KnownILCompilerPack
Include="@(KnownILCompilerPack->WithMetadataValue('TargetFramework', 'net9.0'))"
TargetFramework="${DefaultNetCoreTargetFramework}"
Condition="'@(KnownILCompilerPack->Count())' != '0' AND
!(@(KnownILCompilerPack->AnyHaveMetadataValue('TargetFramework', '${DefaultNetCoreTargetFramework}')))" />
<KnownWebAssemblySdkPack
Include="@(KnownWebAssemblySdkPack->WithMetadataValue('TargetFramework', 'net9.0'))"
TargetFramework="${DefaultNetCoreTargetFramework}"
Condition="'@(KnownWebAssemblySdkPack->Count())' != '0' AND
!(@(KnownWebAssemblySdkPack->AnyHaveMetadataValue('TargetFramework', '${DefaultNetCoreTargetFramework}')))" />
<KnownAspNetCorePack
Include="@(KnownAspNetCorePack->WithMetadataValue('TargetFramework', 'net9.0'))"
TargetFramework="${DefaultNetCoreTargetFramework}"
Condition="'@(KnownAspNetCorePack->Count())' != '0' AND
!(@(KnownAspNetCorePack->AnyHaveMetadataValue('TargetFramework', '${DefaultNetCoreTargetFramework}')))" />
</ItemGroup>
<ItemGroup>
<!--
Reference base shared framework at incoming dependency flow version, not bundled sdk version.
Apply this to all projects that target the default tfm (e.g. net9.0) or a rid-based variant of it (e.g. net9.0-windows)
-->
<FrameworkReference
Update="Microsoft.NETCore.App"
Condition=" (('$(ProjectTargetFrameworkIdentifier)' == '${DefaultNetCoreTargetFramework}') AND '${DefaultNetCoreTargetFramework}' == '$(ProjectTargetFrameworkVersion)') AND '$(TargetLatestDotNetRuntime)' != 'false' "
RuntimeFrameworkVersion="${MicrosoftNETCoreAppRuntimeVersion}"
TargetingPackVersion="${MicrosoftNETCoreAppRefVersion}" />
<PackageReference Include="Microsoft.DotNet.ILCompiler"
Condition=" '$(PublishAot)' == 'true' "
Version="${MicrosoftNETCoreAppRuntimeVersion}" />
</ItemGroup>
<ItemGroup>
<!-- Use the same NETCore shared framework as repo built against except when building product code in servicing. -->
<KnownFrameworkReference Update="Microsoft.NETCore.App">
<LatestRuntimeFrameworkVersion
Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftNETCoreAppRuntimeVersion}</LatestRuntimeFrameworkVersion>
<TargetingPackVersion
Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftNETCoreAppRefVersion}</TargetingPackVersion>
<!--
Change the default shared framework version only when _not_ servicing. Avoid bumping version used in most
projects. When servicing, projects (Microsoft.AspNetCore.App.Runtime in particular) can use
$(TargetLatestRuntimePatch) to explicitly control whether assemblies build against default (false) or
latest (true). When that property is not set, SDK uses default metadata in most cases but published apps
e.g. tool projects (again, property not set) use latest.
On the other hand, $(TargetLatestDotNetRuntime) is specific to this repo and controls only the update below.
-->
<DefaultRuntimeFrameworkVersion Condition=" '$(IsServicingBuild)' != 'true' AND
'%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' AND
'$(TargetLatestDotNetRuntime)' != 'false' ">${MicrosoftNETCoreAppRuntimeVersion}</DefaultRuntimeFrameworkVersion>
<RuntimePackRuntimeIdentifiers Condition="'$(DotNetBuild)' == 'true'">%(RuntimePackRuntimeIdentifiers);$(TargetRuntimeIdentifier)</RuntimePackRuntimeIdentifiers>
</KnownFrameworkReference>
<KnownAppHostPack Update="Microsoft.NETCore.App">
<AppHostPackVersion
Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftNETCoreAppRuntimeVersion}</AppHostPackVersion>
<AppHostRuntimeIdentifiers Condition=" '$(DotNetBuildSourceOnly)' == 'true' ">$(TargetRuntimeIdentifier)</AppHostRuntimeIdentifiers>
</KnownAppHostPack>
<KnownRuntimePack Update="Microsoft.NETCore.App">
<LatestRuntimeFrameworkVersion
Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftNETCoreAppRuntimeVersion}</LatestRuntimeFrameworkVersion>
<AppHostRuntimeIdentifiers Condition=" '$(DotNetBuildSourceOnly)' == 'true' ">$(TargetRuntimeIdentifier)</AppHostRuntimeIdentifiers>
</KnownRuntimePack>
<KnownWebAssemblySdkPack Update="Microsoft.NET.Sdk.WebAssembly.Pack">
<WebAssemblySdkPackVersion
Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftNETCoreAppRuntimeVersion}</WebAssemblySdkPackVersion>
</KnownWebAssemblySdkPack>
<KnownAspNetCorePack Update="Microsoft.AspNetCore.App.Internal.Assets">
<AspNetCorePackVersion
Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftAspNetCoreAppRuntimeVersion}</AspNetCorePackVersion>
</KnownAspNetCorePack>
<KnownCrossgen2Pack Update="Microsoft.NETCore.App.Crossgen2">
<Crossgen2PackVersion
Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftNETCoreAppRuntimeVersion}</Crossgen2PackVersion>
<Crossgen2RuntimeIdentifiers Condition="'$(DotNetBuild)' == 'true'">%(Crossgen2RuntimeIdentifiers);$(NETCoreSdkRuntimeIdentifier);$(TargetRuntimeIdentifier)</Crossgen2RuntimeIdentifiers>
</KnownCrossgen2Pack>
<KnownILLinkPack Update="Microsoft.NET.ILLink.Tasks" Condition=" '$(DotNetBuildSourceOnly)' == 'true' ">
<ILLinkPackVersion
Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftNETCoreAppRuntimeVersion}</ILLinkPackVersion>
</KnownILLinkPack>
<!-- Use the just-built ASP.NET Core shared framework if available except when building product code in servicing. -->
<KnownFrameworkReference Update="Microsoft.AspNetCore.App" Condition=" $(UpdateAspNetCoreKnownFramework) ">
<LatestRuntimeFrameworkVersion
Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftAspNetCoreAppRuntimeVersion}</LatestRuntimeFrameworkVersion>
<RuntimePackRuntimeIdentifiers
Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${SupportedRuntimeIdentifiers}</RuntimePackRuntimeIdentifiers>
<!-- Do not update %(TargetingPackVersion) until X.Y.0 versions have been released. -->
<TargetingPackVersion
Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' AND '${AspNetCorePatchVersion}' != '1' ">${MicrosoftAspNetCoreAppRefVersion}</TargetingPackVersion>
<DefaultRuntimeFrameworkVersion Condition=" '$(IsServicingBuild)' != 'true' AND
'%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftAspNetCoreAppRuntimeVersion}</DefaultRuntimeFrameworkVersion>
</KnownFrameworkReference>
</ItemGroup>
<!-- When building and running locally, manually resolve the just-built frameworks. On Helix, let the SDK resolve the packs itself (they're laid out on top of the .NET SDK in the work items) -->
<PropertyGroup Condition="$(UpdateAspNetCoreKnownFramework) and '$(HELIX_CORRELATION_PAYLOAD)' == ''">
<!-- Allow additional targeting and runtime packs to be downloaded only if required by a test. -->
<EnableTargetingPackDownload Condition="'$(TestRequiresTargetingPackDownload)' != 'true'">false</EnableTargetingPackDownload>
<EnableRuntimePackDownload Condition="'$(TestRequiresRuntimePackDownload)' != 'true'">false</EnableRuntimePackDownload>
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
</PropertyGroup>
<Target Name="ResolveLiveBuiltAspnetCoreKnownFramework" Condition="$(UpdateAspNetCoreKnownFramework) and '$(HELIX_CORRELATION_PAYLOAD)' == ''" AfterTargets="ResolveFrameworkReferences">
<Error Text="Requested Microsoft.AspNetCore.App v${MicrosoftAspNetCoreAppRefVersion} ref pack does not exist."
Condition="!Exists('$(TargetingPackLayoutRoot)packs\Microsoft.AspNetCore.App.Ref\${MicrosoftAspNetCoreAppRefVersion}\data\FrameworkList.xml') " />
<ItemGroup>
<ResolvedTargetingPack Path="$(TargetingPackLayoutRoot)packs\Microsoft.AspNetCore.App.Ref\${MicrosoftAspNetCoreAppRefVersion}"
NugetPackageVersion="${MicrosoftAspNetCoreAppRefVersion}"
PackageDirectory="$(TargetingPackLayoutRoot)packs\Microsoft.AspNetCore.App.Ref\${MicrosoftAspNetCoreAppRefVersion}"
Condition="'%(ResolvedTargetingPack.RuntimeFrameworkName)' == 'Microsoft.AspNetCore.App'" />
<ResolvedRuntimePack PackageDirectory="$(SharedFrameworkLayoutRoot)shared\Microsoft.AspNetCore.App\${MicrosoftAspNetCoreAppRuntimeVersion}"
Condition="'%(ResolvedRuntimePack.RuntimeFrameworkName)' == 'Microsoft.AspNetCore.App'" />
<ResolvedFrameworkReference TargetingPackPath="$(TargetingPackLayoutRoot)packs\Microsoft.AspNetCore.App.Ref\${MicrosoftAspNetCoreAppRefVersion}"
TargetingPackVersion="${MicrosoftAspNetCoreAppRefVersion}"
RuntimePackPath="$(SharedFrameworkLayoutRoot)shared\Microsoft.AspNetCore.App\${MicrosoftAspNetCoreAppRuntimeVersion}"
Condition="'%(Identity)' == 'Microsoft.AspNetCore.App'" />
</ItemGroup>
</Target>
<!--
Make a netstandard2.1 copy of the .net ILLinkPack to work around a trimming issue.
See https://github.com/dotnet/linker/issues/3175
-->
<Target Name="_FixKnownILLinkPack"
BeforeTargets="ProcessFrameworkReferences">
<ItemGroup>
<KnownILLinkPack Include="@(KnownILLinkPack)"
Condition="'%(TargetFramework)' == 'net7.0'"
TargetFramework="netstandard2.1"
ILLinkPackVersion="%(KnownILLinkPack.ILLinkPackVersion)" />
</ItemGroup>
</Target>
</Project>