fix(dotnet): fix dependency graph for multi-targeting and transitive deps#33908
Merged
FrozenPandaz merged 2 commits intomasterfrom Dec 17, 2025
Merged
fix(dotnet): fix dependency graph for multi-targeting and transitive deps#33908FrozenPandaz merged 2 commits intomasterfrom
FrozenPandaz merged 2 commits intomasterfrom
Conversation
This commit fixes two related issues with the .NET dependency graph: 1. Issue #33397: Transitive dependencies were incorrectly shown as direct dependencies in the project graph. Changed from using ProjectGraphNode.ProjectReferences (which includes transitive deps in multi-targeting scenarios) to ProjectInstance.GetItems("ProjectReference") which returns only direct references defined in the project file. 2. Issue #33653: Multi-targeting projects (using TargetFrameworks plural) were losing their dependencies. The fix groups nodes by project file path and prefers inner builds (which have TargetFramework set) over outer builds for configuration, ensuring proper reference resolution. Added e2e tests to verify: - Multi-targeting projects correctly show their dependencies - Only direct dependencies appear in the graph, not transitive ones 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
|
View your CI Pipeline Execution ↗ for commit 27a8023
☁️ Nx Cloud last updated this comment at |
FrozenPandaz
approved these changes
Dec 17, 2025
FrozenPandaz
pushed a commit
that referenced
this pull request
Dec 18, 2025
…deps (#33908) ## Current Behavior Two issues with the .NET dependency graph: 1. Issue #33653: When a .NET project uses multi-targeting (<TargetFrameworks> plural), its project reference dependencies disappear from the Nx graph. 2. Issue #33397: Transitive dependencies are incorrectly shown as direct dependencies. For example, if A → B → C, the graph shows A depending on both B and C, when it should only show A → B. ## Expected Behavior 1. Multi-targeting projects should correctly show their dependencies in the graph. 2. Only direct dependencies should be shown, not transitive ones. Nx handles transitive dependencies through the dependency chain. ### Solution Multi-targeting fix (#33653) MSBuild creates multiple nodes for multi-targeting projects: - An "outer build" with TargetFrameworks set but TargetFramework empty - "Inner builds" for each target framework with TargetFramework set The fix groups nodes by project file path and prefers inner builds (which have properly resolved references) over outer builds. ### Transitive dependency fix (#33397) Changed from using ProjectGraphNode.ProjectReferences (which includes transitive dependencies in multi-targeting scenarios) to ProjectInstance.GetItems("ProjectReference") which returns only direct references defined in the project file. ## Related Issue(s) Fixes #33653 Fixes #33397 --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
|
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Current Behavior
Two issues with the .NET dependency graph:
Expected Behavior
Solution
Multi-targeting fix (#33653)
MSBuild creates multiple nodes for multi-targeting projects:
The fix groups nodes by project file path and prefers inner builds (which have properly resolved references) over outer builds.
Transitive dependency fix (#33397)
Changed from using ProjectGraphNode.ProjectReferences (which includes transitive dependencies in multi-targeting scenarios) to ProjectInstance.GetItems("ProjectReference") which returns only direct references defined in the project file.
Related Issue(s)
Fixes #33653
Fixes #33397