Package Reference Conditional Statement
Unlike the old
<PackageRefence> nodes will only accept conditional statements that are framework based.
Meaning, only a node like this is acceptable
<ItemGroup> <PackageReference Include="Newtonsoft.Json" Version="9.0.1" Condition="'$(TargetFramework)' == 'net452'" /> </ItemGroup>
You can put the
conditional statement in the
As of 2022-10-07, even the official documentation tells you this.
NuGet PackageReference in project files | Microsoft Learn