[Feature Request]: Add ProjectGraph APIs for target framework negotiation #10044
Labels
Area: Static Graph
Issues with -graph, -isolate, and the related APIs.
backlog
Feature Request
Priority:2
Work that is important, but not critical for the release
triaged
Summary
With current ProjectGraph APIs one can analyze project dependencies and retrieve evaluation results. However, given a (multi-targeted) project and a TFM we can't determine from the graph, which nodes of the referenced multi-targeted projects match that specific TFM. This makes it hard to determine values of properties/items across project dependencies.
Background and Motivation
dotnet-watch uses ProjectGraph to determine various properties of the projects that affect its behavior. E.g. to distinguish between Blazor Hosted app and Blazor WASM client app we need to look at project dependencies and check their
ProjectCapability
items. Currently these specific capabilities do not change between TFMs in practice. However, it is entirely possible that in future we might encounter such scenarios, or other cases where we need to analyze TFM-specific project dependency.Proposed Feature
There are multiple options how this feature may be implemented and exposed as public API.
One option is, for example, to specify an optional parameter to the ProjectGraph constructor that instructs it to only include project nodes that match the given TFM (create a subgraph).
Another option might be to add method
ProjectGraphNode? GetProjectReference(string targetFramework)
that returns the node that matches the given TFM for each project node (or null if none does).Alternative Designs
No response
The text was updated successfully, but these errors were encountered: