将一个项目从 ASP.NET Core 9.0 升级至 ASP.NET Core 10.0,并且更新了所有 nuget 包,下面的代码出现 build 错误
public string ExternalAvatarUrl => Principal.FindFirstValue(JwtClaimTypes.Picture);
错误信息如下
The name 'JwtClaimTypes' does not exist in the current context
在 .NET 9 中,JwtClaimTypes 是在 IdentityModel 6.0 中定义的
安装 Duende.IdentityModel 解决了
dotnet add package Duende.IdentityModel --version 8.0.0