Skip to content

Commit e517d74

Browse files
authored
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 70c05f1 commit e517d74

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
@@ -40,37 +40,35 @@
4040

4141
<ItemGroup>
4242
<!-- Use the same NETCore shared framework as repo built against except when building product code in servicing. -->
43-
<KnownFrameworkReference
44-
Update="@(KnownFrameworkReference->WithMetadataValue('Identity', 'Microsoft.NETCore.App')->WithMetadataValue('TargetFramework', '${DefaultNetCoreTargetFramework}'))"
45-
LatestRuntimeFrameworkVersion="${MicrosoftNETCoreAppRuntimeVersion}">
43+
<KnownFrameworkReference Update="Microsoft.NETCore.App">
44+
<LatestRuntimeFrameworkVersion
45+
Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftNETCoreAppRuntimeVersion}</LatestRuntimeFrameworkVersion>
46+
<TargetingPackVersion
47+
Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftNETCoreAppRefVersion}</TargetingPackVersion>
4648
<!--
47-
Change the default shared framework and targeting pack version only when _not_ servicing. Avoid bumping
48-
version used in most projects. When servicing, projects can use $(TargetLatestRuntimePatch) to explicitly
49-
control whether assemblies build against default (false) or latest (true). When that property is not set, SDK
50-
uses default metadata in most cases but published apps e.g. tool projects (again, property not set) use latest.
51-
52-
!temporary! Also check $(TargetLatestRuntimePatch) here because these metadata changes otherwise increase the
53-
minimum versions, making $(TargetLatestRuntimePatch) irrelevant. This helps to avoid problems with current
54-
`[assembly: AssemblyVersion(...)]` changes in dotnet/runtime assemblies and our MSBuild tasks.
49+
Change the default shared framework version only when _not_ servicing. Avoid bumping version used in most
50+
projects. When servicing, projects (Microsoft.AspNetCore.App.Runtime in particular) can use
51+
$(TargetLatestRuntimePatch) to explicitly control whether assemblies build against default (false) or
52+
latest (true). When that property is not set, SDK uses default metadata in most cases but published apps
53+
e.g. tool projects (again, property not set) use latest.
54+
On the other hand, $(TargetLatestDotNetRuntime) is specific to this repo and controls only the update below.
5555
-->
5656
<DefaultRuntimeFrameworkVersion Condition=" '$(IsServicingBuild)' != 'true' AND
57+
'%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' AND
5758
'$(TargetLatestDotNetRuntime)' != 'false' ">${MicrosoftNETCoreAppRuntimeVersion}</DefaultRuntimeFrameworkVersion>
58-
<TargetingPackVersion Condition=" '$(IsServicingBuild)' != 'true' AND
59-
'$(TargetLatestDotNetRuntime)' != 'false' ">${MicrosoftNETCoreAppRefVersion}</TargetingPackVersion>
6059
</KnownFrameworkReference>
6160

6261
<!-- Use the just-built ASP.NET Core shared framework if available except when building product code in servicing. -->
63-
<KnownFrameworkReference
64-
Update="@(KnownFrameworkReference->WithMetadataValue('Identity', 'Microsoft.AspNetCore.App')->WithMetadataValue('TargetFramework', '${DefaultNetCoreTargetFramework}'))"
65-
Condition=" $(UpdateAspNetCoreKnownFramework) "
66-
LatestRuntimeFrameworkVersion="${MicrosoftAspNetCoreAppRuntimeVersion}"
67-
RuntimePackRuntimeIdentifiers="${SupportedRuntimeIdentifiers}">
68-
<DefaultRuntimeFrameworkVersion
69-
Condition=" '$(IsServicingBuild)' != 'true' ">${MicrosoftAspNetCoreAppRuntimeVersion}</DefaultRuntimeFrameworkVersion>
62+
<KnownFrameworkReference Update="Microsoft.AspNetCore.App" Condition=" $(UpdateAspNetCoreKnownFramework) ">
63+
<LatestRuntimeFrameworkVersion
64+
Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftAspNetCoreAppRuntimeVersion}</LatestRuntimeFrameworkVersion>
65+
<RuntimePackRuntimeIdentifiers
66+
Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${SupportedRuntimeIdentifiers}</RuntimePackRuntimeIdentifiers>
7067
<TargetingPackVersion
71-
Condition=" '$(IsServicingBuild)' != 'true' ">${MicrosoftAspNetCoreAppRefVersion}</TargetingPackVersion>
68+
Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftAspNetCoreAppRefVersion}</TargetingPackVersion>
69+
<DefaultRuntimeFrameworkVersion Condition=" '$(IsServicingBuild)' != 'true' AND
70+
'%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftAspNetCoreAppRuntimeVersion}</DefaultRuntimeFrameworkVersion>
7271
</KnownFrameworkReference>
73-
7472
</ItemGroup>
7573

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

0 commit comments

Comments
 (0)