Installing package brings in Mvc.Core dependencies
Hawxy opened this issue · comments
- NuGet Package Version: 4.0.1
- .NET SDK Version: 6.0
Installing 4.0.1 adds a healthy serving of *.Mvc.Core 2.1 deps into a .NET 6 project which isn't ideal, given these are both unneeded and end of life.
I noticed you have a conditional for this in the .csproj:
<FrameworkReference Include="Microsoft.AspNetCore.App" Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.1.0" Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'" />
However TargetFrameworkIdentifier
is a static value based on the target frameworks of the library itself, not the consuming project, so without a netcoreapp
or net5/6
target the FrameworkReference
conditional will never be true.
Good catch, thanks and sorry about that. So, do you know what I should change to get the desired behavior?
Adding a netcoreapp3.1
framework target would be the easiest fix.
Although I would personally just get rid of the .net standard target along with the package reference and just keep the target aligned with .NET LTS versions (3.1 & 6), as I doubt anyone is installing this package in a .NET Core 2.1 application at this point in the lifecycle.