dotnet / project-system

The .NET Project System for Visual Studio
MIT License
959 stars 386 forks source link

Fix calculation of implicit state for package dependencies #9370

Closed drewnoakes closed 5 months ago

drewnoakes commented 6 months ago

Fixes #9368 Fixes #9090

We have two ways of detecting whether a dependency is "implicit": via IsImplicitlyDefined and DefiningProjectFullPath metadata.

It turns out we need to consider both evaluation and build metadata when computing whether package dependencies are implicit. Packages incorrectly advertise IsImplicitlyDefined as false in build data, while its evaluation properties show the DefiningProjectFullPath as differing from the project's path. So this change prioritises DefiningProjectFullPath over IsImplicitlyDefined, to work around the incorrect value in build data, and includes both evaluation and build properties, to allow reading the DefiningFullPath value when processing a build update.

Microsoft Reviewers: Open in CodeFlow
drewnoakes commented 6 months ago

With this fix, the scenario in the linked issue now displays correctly:

image