Skip to content

Conversation

@twsouthwick
Copy link
Member

An add on from #10470 that added support for netstandard2.0, this adds
an explicit net462 target which is part of the recommendation for
multi-targetd libraries.

Copilot AI review requested due to automatic review settings August 26, 2025 17:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds explicit .NET Framework 4.6.2 (net462) targeting to the ServiceDiscovery libraries, complementing the existing netstandard2.0 and modern .NET targets. This follows Microsoft's recommendations for multi-targeted libraries to provide better compatibility with .NET Framework applications.

  • Adds net462 to the TargetFrameworks property in both projects
  • Updates AOT compatibility conditions to exclude net462 instead of just netstandard2.0
  • Extends conditional package references and imports to include net462 alongside netstandard2.0

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
Microsoft.Extensions.ServiceDiscovery.csproj Adds net462 target and updates conditions for AOT compatibility, package references, and polyfill imports
Microsoft.Extensions.ServiceDiscovery.Abstractions.csproj Adds net462 target and updates conditions for AOT compatibility, package references, and polyfill imports

An add on from  dotnet#10470 that added support for netstandard2.0, this adds
an explicit net462 target which is part of the recommendation for
multi-targetd libraries.
Copy link
Member

@joperezr joperezr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good other than reversing the condition

@JamesNK
Copy link
Member

JamesNK commented Aug 29, 2025

Reason why: https://learn.microsoft.com/en-us/dotnet/standard/library-guidance/cross-platform-targeting

Using .NET Standard 2.0 from .NET Framework has some issues that were addressed in .NET Framework 4.7.2. You can improve the experience for developers that are still on .NET Framework 4.6.2 - 4.7.1 by offering them a binary that's built for .NET Framework 4.6.2.

4.6.2 is supported until 2027.

@twsouthwick twsouthwick enabled auto-merge (squash) September 2, 2025 16:46
@twsouthwick twsouthwick merged commit 12a2f5b into dotnet:main Sep 2, 2025
292 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the 9.5 milestone Sep 2, 2025
@twsouthwick twsouthwick deleted the sd-net472 branch September 2, 2025 19:23
Copilot AI pushed a commit that referenced this pull request Sep 3, 2025
An add on from  #10470 that added support for netstandard2.0, this adds
an explicit net462 target which is part of the recommendation for
multi-targeted libraries.
@github-actions github-actions bot locked and limited conversation to collaborators Oct 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants