Skip to content

Commit

Permalink
[release/7.0] Fix pinned assembly version 7.0 (#84355)
Browse files Browse the repository at this point in the history
* Eight packable projects pin their assembly version for .NET Framework compatibility. The incremental package servicing infrastructure didn't check if the assembly version is pinned and changed it during servicing.

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

For System.DirectoryServices.Protocols and System.Management we'll only pin the version for the .NETStandard assembly since those previously shipped the newer versions in servicing.

* Enable System.Management and System.DirectoryServices.Protocols in servicing

* Address feedback
  • Loading branch information
ericstj committed Apr 6, 2023
1 parent 0506145 commit c2d6594
Show file tree
Hide file tree
Showing 20 changed files with 76 additions and 33 deletions.
2 changes: 1 addition & 1 deletion eng/packaging.targets
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<_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. -->
<!-- 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>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<!-- Reference the outputs for the dependency nodes calculation. -->
<NoTargetsDoNotReferenceOutputAssemblies>false</NoTargetsDoNotReferenceOutputAssemblies>
<IsPackable>true</IsPackable>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<ServicingVersion>1</ServicingVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<ServicingVersion>2</ServicingVersion>
<!-- This is a meta package and doesn't contain any libs. -->
<NoWarn>$(NoWarn);NU5128</NoWarn>
<PackageDescription>This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET as well as .NET Standard.</PackageDescription>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project>
<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<StrongNameKeyId>ECMA</StrongNameKeyId>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project>
<Import Project="..\Directory.Build.targets" />
<PropertyGroup>
<!-- This assembly is inbox in .NETFramework, ensure that the AssemblyVersion
remains <= the .NETFramework version -->
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<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>
<SupportedOSPlatforms>windows</SupportedOSPlatforms>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project>
<Import Project="..\Directory.Build.targets" />
<PropertyGroup>
<!-- This assembly is inbox in .NETFramework, ensure that the AssemblyVersion
remains <= the .NETFramework version -->
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<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>Microsoft</StrongNameKeyId>
<IncludePlatformAttributes>true</IncludePlatformAttributes>
<UnsupportedOSPlatforms>browser;android;ios;tvos</UnsupportedOSPlatforms>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project>
<Import Project="..\Directory.Build.targets" />
<PropertyGroup>
<!-- This assembly is inbox in .NETFramework, ensure that the .NETStandard assembly
remains <= the .NETFramework version.
Allow non-NETStandard assemblies to version to be compatible with past serviced packages which
shipped higher versions. -->
<AssemblyVersion Condition="'$(TargetFramework)' == 'netstandard2.0'">4.0.0.0</AssemblyVersion>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<IncludeDllSafeSearchPathAttribute>true</IncludeDllSafeSearchPathAttribute>
<IsPackable>true</IsPackable>
<!-- If you enable GeneratePackageOnBuild for this package and bump ServicingVersion, make sure to also bump ServicingVersion in Microsoft.Windows.Compatibility.csproj once for the next release. -->
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<ServicingVersion>0</ServicingVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<ServicingVersion>1</ServicingVersion>
<Nullable>annotations</Nullable>
<AddNETFrameworkPlaceholderFileToPackage>true</AddNETFrameworkPlaceholderFileToPackage>
<AddNETFrameworkAssemblyReferenceToPackage>true</AddNETFrameworkAssemblyReferenceToPackage>
Expand Down
4 changes: 0 additions & 4 deletions src/libraries/System.DirectoryServices/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<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>
<!-- Since this assembly version is pinned, we don't want to validate that it matches
the expected assembly version on the targeting pack. -->
<SkipValidateAssemblyVersion>true</SkipValidateAssemblyVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project>
<Import Project="..\Directory.Build.targets" />
<PropertyGroup>
<!-- This assembly is inbox in .NETFramework, ensure that the AssemblyVersion
remains <= the .NETFramework version -->
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</PropertyGroup>
</Project>
4 changes: 0 additions & 4 deletions src/libraries/System.Management/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<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>Microsoft</StrongNameKeyId>
<SupportedOSPlatforms>windows</SupportedOSPlatforms>
</PropertyGroup>
Expand Down
10 changes: 10 additions & 0 deletions src/libraries/System.Management/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project>
<Import Project="..\Directory.Build.targets" />
<PropertyGroup>
<!-- This assembly is inbox in .NETFramework, ensure that the .NETStandard assembly
remains <= the .NETFramework version.
Allow non-NETStandard assemblies to version to be compatible with past serviced packages which
shipped higher versions. -->
<AssemblyVersion Condition="'$(TargetFramework)' == 'netstandard2.0'">4.0.0.0</AssemblyVersion>
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions src/libraries/System.Management/src/System.Management.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<IncludeDllSafeSearchPathAttribute>true</IncludeDllSafeSearchPathAttribute>
<IsPackable>true</IsPackable>
<!-- If you enable GeneratePackageOnBuild for this package and bump ServicingVersion, make sure to also bump ServicingVersion in Microsoft.Windows.Compatibility.csproj once for the next release. -->
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<ServicingVersion>1</ServicingVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<ServicingVersion>2</ServicingVersion>
<AddNETFrameworkPlaceholderFileToPackage>true</AddNETFrameworkPlaceholderFileToPackage>
<AddNETFrameworkAssemblyReferenceToPackage>true</AddNETFrameworkAssemblyReferenceToPackage>
<PackageDescription>Provides access to a rich set of management information and management events about the system, devices, and applications instrumented to the Windows Management Instrumentation (WMI) infrastructure.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project>
<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<StrongNameKeyId>ECMA</StrongNameKeyId>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project>
<Import Project="..\Directory.Build.targets" />
<PropertyGroup>
<!-- This assembly is inbox in .NETFramework, ensure that the AssemblyVersion
remains <= the .NETFramework version.
4.0.3.0 breaks this causing https://github.com/dotnet/runtime/issues/84320 -->
<AssemblyVersion>4.0.3.0</AssemblyVersion>
</PropertyGroup>
</Project>
4 changes: 0 additions & 4 deletions src/libraries/System.Runtime.Caching/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<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>Microsoft</StrongNameKeyId>
<IncludePlatformAttributes>true</IncludePlatformAttributes>
</PropertyGroup>
Expand Down
8 changes: 8 additions & 0 deletions src/libraries/System.Runtime.Caching/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project>
<Import Project="..\Directory.Build.targets" />
<PropertyGroup>
<!-- This assembly is inbox in .NETFramework, ensure that the AssemblyVersion
remains <= the .NETFramework version -->
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</PropertyGroup>
</Project>
4 changes: 0 additions & 4 deletions src/libraries/System.Speech/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<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>MicrosoftShared</StrongNameKeyId>
<SupportedOSPlatforms>windows</SupportedOSPlatforms>
</PropertyGroup>
Expand Down
8 changes: 8 additions & 0 deletions src/libraries/System.Speech/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project>
<Import Project="..\Directory.Build.targets" />
<PropertyGroup>
<!-- This assembly is inbox in .NETFramework, ensure that the AssemblyVersion
remains <= the .NETFramework version -->
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</PropertyGroup>
</Project>

0 comments on commit c2d6594

Please sign in to comment.