Skip to content

Commit 8fd0398

Browse files
authored
[release/6.0] Always use latest targeting packs (#37120)
- backport of #36718 Always use latest targeting packs (#36718) - also, only update latest `@(KnownFrameworkReference)` items - previously the updates applied e.g. to all Microsoft.NETCore.App items nit: expand `@(KnownFrameworkReference)` comments
1 parent 9d1273a commit 8fd0398

File tree

1 file changed

+20
-22
lines changed

1 file changed

+20
-22
lines changed

eng/tools/GenerateFiles/Directory.Build.targets.in

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,37 +23,35 @@
2323

2424
<ItemGroup>
2525
<!-- Use the same NETCore shared framework as repo built against except when building product code in servicing. -->
26-
<KnownFrameworkReference
27-
Update="@(KnownFrameworkReference->WithMetadataValue('Identity', 'Microsoft.NETCore.App')->WithMetadataValue('TargetFramework', '${DefaultNetCoreTargetFramework}'))"
28-
LatestRuntimeFrameworkVersion="${MicrosoftNETCoreAppRuntimeVersion}">
26+
<KnownFrameworkReference Update="Microsoft.NETCore.App">
27+
<LatestRuntimeFrameworkVersion
28+
Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftNETCoreAppRuntimeVersion}</LatestRuntimeFrameworkVersion>
29+
<TargetingPackVersion
30+
Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftNETCoreAppRefVersion}</TargetingPackVersion>
2931
<!--
30-
Change the default shared framework and targeting pack version only when _not_ servicing. Avoid bumping
31-
version used in most projects. When servicing, projects can use $(TargetLatestRuntimePatch) to explicitly
32-
control whether assemblies build against default (false) or latest (true). When that property is not set, SDK
33-
uses default metadata in most cases but published apps e.g. tool projects (again, property not set) use latest.
34-
35-
!temporary! Also check $(TargetLatestRuntimePatch) here because these metadata changes otherwise increase the
36-
minimum versions, making $(TargetLatestRuntimePatch) irrelevant. This helps to avoid problems with current
37-
`[assembly: AssemblyVersion(...)]` changes in dotnet/runtime assemblies and our MSBuild tasks.
32+
Change the default shared framework version only when _not_ servicing. Avoid bumping version used in most
33+
projects. When servicing, projects (Microsoft.AspNetCore.App.Runtime in particular) can use
34+
$(TargetLatestRuntimePatch) to explicitly control whether assemblies build against default (false) or
35+
latest (true). When that property is not set, SDK uses default metadata in most cases but published apps
36+
e.g. tool projects (again, property not set) use latest.
37+
On the other hand, $(TargetLatestDotNetRuntime) is specific to this repo and controls only the update below.
3838
-->
3939
<DefaultRuntimeFrameworkVersion Condition=" '$(IsServicingBuild)' != 'true' AND
40+
'%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' AND
4041
'$(TargetLatestDotNetRuntime)' != 'false' ">${MicrosoftNETCoreAppRuntimeVersion}</DefaultRuntimeFrameworkVersion>
41-
<TargetingPackVersion Condition=" '$(IsServicingBuild)' != 'true' AND
42-
'$(TargetLatestDotNetRuntime)' != 'false' ">${MicrosoftNETCoreAppRefVersion}</TargetingPackVersion>
4342
</KnownFrameworkReference>
4443

4544
<!-- Use the just-built ASP.NET Core shared framework if available except when building product code in servicing. -->
46-
<KnownFrameworkReference
47-
Update="@(KnownFrameworkReference->WithMetadataValue('Identity', 'Microsoft.AspNetCore.App')->WithMetadataValue('TargetFramework', '${DefaultNetCoreTargetFramework}'))"
48-
Condition=" $(UpdateAspNetCoreKnownFramework) "
49-
LatestRuntimeFrameworkVersion="${MicrosoftAspNetCoreAppRuntimeVersion}"
50-
RuntimePackRuntimeIdentifiers="${SupportedRuntimeIdentifiers}">
51-
<DefaultRuntimeFrameworkVersion
52-
Condition=" '$(IsServicingBuild)' != 'true' ">${MicrosoftAspNetCoreAppRuntimeVersion}</DefaultRuntimeFrameworkVersion>
45+
<KnownFrameworkReference Update="Microsoft.AspNetCore.App" Condition=" $(UpdateAspNetCoreKnownFramework) ">
46+
<LatestRuntimeFrameworkVersion
47+
Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftAspNetCoreAppRuntimeVersion}</LatestRuntimeFrameworkVersion>
48+
<RuntimePackRuntimeIdentifiers
49+
Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${SupportedRuntimeIdentifiers}</RuntimePackRuntimeIdentifiers>
5350
<TargetingPackVersion
54-
Condition=" '$(IsServicingBuild)' != 'true' ">${MicrosoftAspNetCoreAppRefVersion}</TargetingPackVersion>
51+
Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftAspNetCoreAppRefVersion}</TargetingPackVersion>
52+
<DefaultRuntimeFrameworkVersion Condition=" '$(IsServicingBuild)' != 'true' AND
53+
'%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftAspNetCoreAppRuntimeVersion}</DefaultRuntimeFrameworkVersion>
5554
</KnownFrameworkReference>
56-
5755
</ItemGroup>
5856

5957
<!-- Warn if the "just-built" ASP.NET Core shared framework does not exist. -->

0 commit comments

Comments
 (0)