Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add extra parameter to get nearest - #12932

#12932
Merged
JanProvaznik merged 4 commits into
maindotnet/msbuild:mainfrom
dev-nkolev92-addExtraParameterToGetNearestdotnet/msbuild:dev-nkolev92-addExtraParameterToGetNearestCopy head branch name to clipboard
Dec 19, 2025
Merged

Add extra parameter to get nearest#12932
JanProvaznik merged 4 commits into
maindotnet/msbuild:mainfrom
dev-nkolev92-addExtraParameterToGetNearestdotnet/msbuild:dev-nkolev92-addExtraParameterToGetNearestCopy head branch name to clipboard

Conversation

@nkolev92

@nkolev92 nkolev92 commented Dec 12, 2025

Copy link
Copy Markdown
Contributor

Fixes #

Context

Design: NuGet/Home#12124

To allow duplicate frameworks in aliasing, the project reference protocol nearest framework selection needs to be updated to support matching by alias as well.

Relevant part:
https://github.com/NuGet/Home/blob/dev-nkolev92-tfmaliases/accepted/2025/Multiple-Equivalent-Framework-Support-TFM-As-Aliases.md#project-to-project-references

NuGet/NuGet.Client#7011 NuGet.Client side adding the parameter.
NuGet/NuGet.Client#6972 will add the full implementation at a later point.

Changes Made

  • Pass CurrentProjectTargetFrameworkProperty if GetReferenceNearestTargetFrameworkTaskSupportsTargetFrameworKPropertyParameter is set.
  • If GetReferenceNearestTargetFrameworkTaskSupportsTargetFrameworKPropertyParameter is not set, but GetReferenceNearestTargetFrameworkTaskSupportsTargetPlatformParameter is set, call the old variation.
  • Otherwise calls the last variation.

Testing

  • Manual testing.
  • I'd be happy to add tests if someone can point me in the right direction.

Notes

The idea here is to get ahead of things. Currently aliasing work can't be end to end tested because it requires an msbuild change. It makes it really hard to validate the NuGet changes are enough and good, but this is the only change needed on the msbuild side.

@nkolev92
nkolev92 marked this pull request as ready for review December 16, 2025 02:18
@nkolev92
nkolev92 force-pushed the dev-nkolev92-addExtraParameterToGetNearest branch from 247f151 to 559afab Compare December 16, 2025 02:18
Copilot AI review requested due to automatic review settings December 16, 2025 02:18
@nkolev92

Copy link
Copy Markdown
Contributor Author

cc @rainersigwald

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 support for passing the target framework property (TargetFramework) to the GetReferenceNearestTargetFrameworkTask to enable framework aliasing support. This change allows NuGet's project reference protocol to match frameworks by both their moniker and their alias, which is necessary for supporting duplicate frameworks with different aliases.

Key Changes:

  • Add new CurrentProjectTargetFrameworkProperty parameter to the GetReferenceNearestTargetFrameworkTask call
  • Implement backward compatibility by maintaining three separate invocation paths based on feature flags
  • Update documentation to reflect the new parameter availability in MSBuild 18.3

Reviewed changes

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

File Description
src/Tasks/Microsoft.Common.CurrentVersion.targets Adds three-tier invocation logic for GetReferenceNearestTargetFrameworkTask with backward compatibility, passing CurrentProjectTargetFrameworkProperty when supported
documentation/ProjectReference-Protocol.md Documents the new TargetFramework metadata availability in MSBuild 18.3

Comment thread src/Tasks/Microsoft.Common.CurrentVersion.targets Outdated
Comment thread src/Tasks/Microsoft.Common.CurrentVersion.targets
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.