Skip to content

Commit f9d2fa9

Browse files
authored
Fix _AssemblyInTargetingPack value during servicing (#95278)
* Fix _AssemblyInTargetingPack value during servicing The _AssemblyInTargetingPack property in packaging.targets depends on `IsNETCoreAppSrc` or `IsNetCoreAppRef` which aren't defined until src/libraries/Directory.Build.targets is imported. As packaging.targets is imported first, there's a property sequencing issue. The fix is to move the ´_AssemblyInTargetingPack` logic out of packaging.targets as that's code that is specific to targeting pack libraries which reside under src/libraries. This fixes the issue that appeared in the release/8.0 branch for main. * Update Directory.Build.targets * Update Directory.Build.targets
1 parent 56cf645 commit f9d2fa9

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

eng/packaging.targets

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@
6262
<!-- Always update the package version in servicing. -->
6363
<Version>$(MajorVersion).$(MinorVersion).$(ServicingVersion)</Version>
6464
<Version Condition="'$(VersionSuffix)' != ''">$(Version)-$(VersionSuffix)</Version>
65-
<_IsWindowsDesktopApp Condition="$(WindowsDesktopCoreAppLibrary.Contains('$(AssemblyName);'))">true</_IsWindowsDesktopApp>
66-
<_IsAspNetCoreApp Condition="$(AspNetCoreAppLibrary.Contains('$(AssemblyName);'))">true</_IsAspNetCoreApp>
67-
<_AssemblyInTargetingPack Condition="('$(IsNETCoreAppSrc)' == 'true' or '$(IsNetCoreAppRef)' == 'true' or '$(_IsAspNetCoreApp)' == 'true' or '$(_IsWindowsDesktopApp)' == 'true') and '$(TargetFrameworkIdentifier)' != '.NETFramework'">true</_AssemblyInTargetingPack>
68-
<!-- The assembly version gets updated when the assembly isn't part of a targeting pack. -->
69-
<AssemblyVersion Condition="'$(_AssemblyInTargetingPack)' != 'true'">$(MajorVersion).$(MinorVersion).0.$(ServicingVersion)</AssemblyVersion>
7065
</PropertyGroup>
7166

7267
<ItemGroup>

src/libraries/Directory.Build.targets

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,16 @@
7070
'$(GeneratePlatformNotSupportedAssemblyMessage)' == ''">true</ILLinkTrimAssembly>
7171
</PropertyGroup>
7272

73+
<!-- The assembly version gets updated during servicing when the assembly isn't part of a targeting pack. -->
74+
<PropertyGroup Condition="'$(PreReleaseVersionLabel)' == 'servicing' and
75+
'$(IsPackable)' == 'true' and
76+
'$(PackageUseIncrementalServicingVersion)' == 'true'">
77+
<_IsWindowsDesktopApp Condition="$(WindowsDesktopCoreAppLibrary.Contains('$(AssemblyName);'))">true</_IsWindowsDesktopApp>
78+
<_IsAspNetCoreApp Condition="$(AspNetCoreAppLibrary.Contains('$(AssemblyName);'))">true</_IsAspNetCoreApp>
79+
<_AssemblyInTargetingPack Condition="('$(IsNETCoreAppSrc)' == 'true' or '$(IsNetCoreAppRef)' == 'true' or '$(_IsAspNetCoreApp)' == 'true' or '$(_IsWindowsDesktopApp)' == 'true') and '$(TargetFrameworkIdentifier)' != '.NETFramework'">true</_AssemblyInTargetingPack>
80+
<AssemblyVersion Condition="'$(_AssemblyInTargetingPack)' != 'true'">$(MajorVersion).$(MinorVersion).0.$(ServicingVersion)</AssemblyVersion>
81+
</PropertyGroup>
82+
7383
<Import Project="$(RepositoryEngineeringDir)versioning.targets" />
7484
<Import Project="$(RepositoryEngineeringDir)intellisense.targets" Condition="'$(IsSourceProject)' == 'true'" />
7585

0 commit comments

Comments
 (0)