-
Notifications
You must be signed in to change notification settings - Fork 10
Description
It seems to me that the tool currently only checks <PackageReference>
elements in csprojs without parsing and evaluating said csprojs. This causes Condition
s in csprojs not to be applied either, causing the tool to process package references that aren't actually active in the current context.
For example, we have this in one of our projects:
<ItemGroup Condition="'$(NuGetBuild)' == 'true'">
<PackageReference Include="Lombiq.HelpfulLibraries.OrchardCore" Version="8.0.2" />
</ItemGroup>
This package reference is checked for consolidation even if the NuGetBuild
variable is not true
.
This is an issue because it necessitates keeping package references consolidated that we don't actually need, see #41 (comment).
You don't necessarily need to parse these Condition
s; rather, MSBuild can be used to get these values. For an inspiration, check out this code that similarly retrieves an MSBuild property's value.