Skip to content

Commit

Permalink
Don't overwrite pinned assembly versions in servicing
Browse files Browse the repository at this point in the history
There are eight packable projects that pin their assembly version for .NET
Framework compatibility. The incremental package servicing
infrastructure didn't check if the assembly version is pinned and always
changed it.

As an example, System.Speech pins its assembly version to 4.0.0.0 but
that version gets overwritten during servicing. I.e. for .NET 7 the
version would then change to "7.0.0.$(ServicingVersion)" which is
incorrect.

Please find the full list of impacted assemblies below:
- System.ComponentModel.Composition
- System.DirectoryServices
- System.DirectoryServices.AccountManagement
- System.DirectoryServices.Protocols
- System.Management
- System.Reflection.Context
- System.Runtime.Caching
- System.Speech
  • Loading branch information
ViktorHofer committed Mar 29, 2023
1 parent 3231e4f commit 02eb3a8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
6 changes: 4 additions & 2 deletions eng/packaging.targets
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@
<_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>
<!-- Assembly version do not get updated in non-netfx ref pack assemblies. -->
<AssemblyVersion Condition="'$(_AssemblyInTargetingPack)' != 'true'">$(MajorVersion).$(MinorVersion).0.$(ServicingVersion)</AssemblyVersion>
<!-- The assembly version gets updated when
- it isn't already set (i.e. it could be pinned to a specific version for .NET Framework compatibility) and
- the assembly isn't part of a targeting pack (always true for .NET Framework). -->
<AssemblyVersion Condition="'$(AssemblyVersion)' == '' and '$(_AssemblyInTargetingPack)' != 'true'">$(MajorVersion).$(MinorVersion).0.$(ServicingVersion)</AssemblyVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<Project>
<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<!-- this assembly is inbox in desktop, do not version it unless you
plan on shipping a new desktop version out of band. Instead add API
to a different assembly. -->
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<StrongNameKeyId>ECMA</StrongNameKeyId>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<Project>
<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<!-- AssemblyVersion is frozen to that which originally shipped in 2.1 -->
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<StrongNameKeyId>ECMA</StrongNameKeyId>
</PropertyGroup>
</Project>
3 changes: 3 additions & 0 deletions src/libraries/System.Reflection.Context/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<Project>
<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<!-- this assembly is inbox in desktop, do not version it unless you
plan on shipping a new desktop version out of band. Instead add API
to a different assembly. -->
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<StrongNameKeyId>ECMA</StrongNameKeyId>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- this assembly is inbox in desktop, do not version it unless you
plan on shipping a new desktop version out of band. Instead add API
to a different assembly. -->
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.1;netstandard2.0</TargetFrameworks>
</PropertyGroup>

Expand Down

0 comments on commit 02eb3a8

Please sign in to comment.