Repository navigation
Pack is aliased framework aware and supports deduplication to allowed aliased projects to be packed. - #7227
Merged
Conversation
jeffkl
approved these changes
Mar 23, 2026
ViktorHofer
reviewed
Mar 24, 2026
Contributor
There was a problem hiding this comment.
nit: the .designer.cs file isn't supposed to be checked in. Most arcadified repos use the GenerateSource=true metadata on EmbeddedResource item integration to automatically create the file on build. Completely unrelated to this PR, just a side observation.
Member
Author
There was a problem hiding this comment.
interesting. Is there a perf consideration there?
Contributor
There was a problem hiding this comment.
Not that I'm aware of. The task that creates it is optimized. It's also incremental build aware.
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#14751
Fixes: NuGet/Home#14535
Description
Makes NuGet Pack aliased-framework-aware. When a project has multiple TFM aliases that resolve to the same NuGet framework (e.g., TargetFrameworks=apple;banana where both map to net10.0), pack now detects the ambiguity and raises NU5051 with an actionable error message instead of silently producing a broken package or crashing.
Users can resolve the ambiguity by setting per-alias MSBuild properties:
• IncludeBuildOutput=false — suppresses build output from the secondary alias
• SuppressDependenciesWhenPacking=true — suppresses dependency inclusion from the secondary alias
When both are set on all but one alias per effective framework, pack succeeds and produces a single lib group and a single dependency group for that framework. Framework references are also deduplicated — if all aliases for a framework declare identical FrameworkReference items, they're merged silently; if they differ, NU5051 is raised. People can suppress FrameworkReference with PrivateAssets="all". Im hesitant to add another mechanism similar to suppress dependencies when packing without more feedback.
Note that the deduplication is detected based on the where the files go, so if someone wants to make the build out from one leg go to the runtimes folder, but in the lib folder in another one, that should be now possible.
cc @ViktorHofer @ericstj I know you had feedback on the pack experience.
PR Checklist