dotnet / project-system

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

Use dependency ID in project tree flags correctly #9371

Closed drewnoakes closed 5 months ago

drewnoakes commented 6 months ago

Dependency nodes in the tree have various flags, which allow other code to inspect dependencies in order to interact with them (commands, attaching children, etc.).

Flags are computed via the virtual UpdateTreeFlags method, and certain MSBuild dependency factories override this method to include additional logic.

For package dependencies, the dependency's ID is added as a flag of form $ID:MyPackage.

An unresolved package dependency has item spec MyPackage, whereas the resolved form includes the version MyPackage/1.2.3. The code was incorrectly passing the resolved form, including the version. This change ensures we pass the ID, which is consistent regardless of whether the dependency is resolved or not.

This fix could, under certain timing conditions, fix issues where child nodes are not attached correctly to package nodes in the tree.

Microsoft Reviewers: Open in CodeFlow