Skip to content

Commit

Permalink
Fix _AssemblyInTargetingPack value during servicing (#95278)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ViktorHofer authored Nov 29, 2023
1 parent 56cf645 commit f9d2fa9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 0 additions & 5 deletions eng/packaging.targets
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@
<!-- Always update the package version in servicing. -->
<Version>$(MajorVersion).$(MinorVersion).$(ServicingVersion)</Version>
<Version Condition="'$(VersionSuffix)' != ''">$(Version)-$(VersionSuffix)</Version>
<_IsWindowsDesktopApp Condition="$(WindowsDesktopCoreAppLibrary.Contains('$(AssemblyName);'))">true</_IsWindowsDesktopApp>
<_IsAspNetCoreApp Condition="$(AspNetCoreAppLibrary.Contains('$(AssemblyName);'))">true</_IsAspNetCoreApp>
<_AssemblyInTargetingPack Condition="('$(IsNETCoreAppSrc)' == 'true' or '$(IsNetCoreAppRef)' == 'true' or '$(_IsAspNetCoreApp)' == 'true' or '$(_IsWindowsDesktopApp)' == 'true') and '$(TargetFrameworkIdentifier)' != '.NETFramework'">true</_AssemblyInTargetingPack>
<!-- The assembly version gets updated when the assembly isn't part of a targeting pack. -->
<AssemblyVersion Condition="'$(_AssemblyInTargetingPack)' != 'true'">$(MajorVersion).$(MinorVersion).0.$(ServicingVersion)</AssemblyVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
10 changes: 10 additions & 0 deletions src/libraries/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@
'$(GeneratePlatformNotSupportedAssemblyMessage)' == ''">true</ILLinkTrimAssembly>
</PropertyGroup>

<!-- The assembly version gets updated during servicing when the assembly isn't part of a targeting pack. -->
<PropertyGroup Condition="'$(PreReleaseVersionLabel)' == 'servicing' and
'$(IsPackable)' == 'true' and
'$(PackageUseIncrementalServicingVersion)' == 'true'">
<_IsWindowsDesktopApp Condition="$(WindowsDesktopCoreAppLibrary.Contains('$(AssemblyName);'))">true</_IsWindowsDesktopApp>
<_IsAspNetCoreApp Condition="$(AspNetCoreAppLibrary.Contains('$(AssemblyName);'))">true</_IsAspNetCoreApp>
<_AssemblyInTargetingPack Condition="('$(IsNETCoreAppSrc)' == 'true' or '$(IsNetCoreAppRef)' == 'true' or '$(_IsAspNetCoreApp)' == 'true' or '$(_IsWindowsDesktopApp)' == 'true') and '$(TargetFrameworkIdentifier)' != '.NETFramework'">true</_AssemblyInTargetingPack>
<AssemblyVersion Condition="'$(_AssemblyInTargetingPack)' != 'true'">$(MajorVersion).$(MinorVersion).0.$(ServicingVersion)</AssemblyVersion>
</PropertyGroup>

<Import Project="$(RepositoryEngineeringDir)versioning.targets" />
<Import Project="$(RepositoryEngineeringDir)intellisense.targets" Condition="'$(IsSourceProject)' == 'true'" />

Expand Down

0 comments on commit f9d2fa9

Please sign in to comment.