Add extra parameter to get nearest - #12932
#12932Merged
JanProvaznik merged 4 commits intoDec 19, 2025
maindotnet/msbuild:mainfrom
dev-nkolev92-addExtraParameterToGetNearestdotnet/msbuild:dev-nkolev92-addExtraParameterToGetNearestCopy head branch name to clipboard
Merged
Add extra parameter to get nearest#12932JanProvaznik merged 4 commits intomaindotnet/msbuild:mainfrom dev-nkolev92-addExtraParameterToGetNearestdotnet/msbuild:dev-nkolev92-addExtraParameterToGetNearestCopy head branch name to clipboard
JanProvaznik merged 4 commits into
maindotnet/msbuild:mainfrom
dev-nkolev92-addExtraParameterToGetNearestdotnet/msbuild:dev-nkolev92-addExtraParameterToGetNearestCopy head branch name to clipboard
Conversation
Closed
3 tasks
nkolev92
marked this pull request as ready for review
December 16, 2025 02:18
nkolev92
force-pushed
the
dev-nkolev92-addExtraParameterToGetNearest
branch
from
December 16, 2025 02:18
247f151 to
559afab
Compare
Contributor
Author
Contributor
There was a problem hiding this comment.
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
CurrentProjectTargetFrameworkPropertyparameter to theGetReferenceNearestTargetFrameworkTaskcall - 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 |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This was referenced Dec 16, 2025
rainersigwald
approved these changes
Dec 16, 2025
JanProvaznik
approved these changes
Dec 19, 2025
This was referenced Dec 20, 2025
Merged
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Testing
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.