Turns out this can also happen in cases when your package doesn't support your solution.
In my case, I had a .NET 8 project:
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
I was trying to install Microsoft.AspNetCore.Authentication.JwtBearer
version 9.0.1, which is only compatible with net9.0
.
The solution? Install the 8.0.12 version of the package instead. Problem solved.