Repository navigation
Restore's warning and errors calculation uses string alias as a pivot instead of NuGetFramework - #7153
Closed
nkolev92 wants to merge 8 commits into
Closed
Restore's warning and errors calculation uses string alias as a pivot instead of NuGetFramework#7153nkolev92 wants to merge 8 commits into
nkolev92 wants to merge 8 commits into
Conversation
This was referenced Feb 19, 2026
Member
Author
3 tasks done
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.
Bug
Fixes: NuGet/Home#14756
Description
In #6805 and more notably in #6923 a sizable part of the restore core logic was reworked to consider aliases as pivot instead of NuGetFramework.
Turns out that was handled pretty well in most cases, except in scenarios where the TargetFramework element does not actually match the GetShortFolderName of a framework.
In these cases, package specific suppressions do not work.
An example is net10.0-windows frameworks. Maui projects would probably suffer from the same issue as well as the linked issues suggest.
Originally in #6805 and #6923 a large majority of the internal restore infrastructure was changed to use string alias, instead of the NuGetFramework.
Note that this work was done in a way that didn't make intentional functional changes, but simply made changes that are purely internal.
Turns out that it ended up breaking package specific warning suppressions for aliased frameworks such as net10.0-windows. Projects like maui have this issue as well.
The root cause for that is that now all RestoreLogMessage have a target graph that has the alias. Note that this TargetGraphName is shared in many places, so it'll be really hard to understand the impact it'd have if we chnaged it for log messages only.
Workaround: Set the full name of the TargetFramework, so for net10.0-windows set net10.0-windows7.0.
The changes made in the above PRs are like dominos. A lot of changes went on top of those changes, so simply reverting the PR or PRs actually introduces a new risk since there's at least 3-4 other PRs that have now taken dependency on changes so this PR takes it the whole way, in a way that's purely localized to the broken scenario + warning suppression.
Here are some reviewing helpers:
Note that for legacy projects, the TargetAlias is "", but the RestoreGraphName has the full target framework name. In order to handle this, we special change when detecting suppressions. Legacy projects always have one framework, so it's safe to just check against that existing framework.
Beyond that, it's all tests really.
PR Checklist
Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.