Migration 找不到DataProtectorTokenProvider构造函数方法

Migration 找不到DataProtectorTokenProvider构造函数方法,migration,asp.net-core-2.2,asp.net-core-3.1,asp.net-core-identity,Migration,Asp.net Core 2.2,Asp.net Core 3.1,Asp.net Core Identity,我在.NETCore2.2中使用了两个具有标识的自定义令牌提供程序。在迁移到3.1之后,我得到了这个异常 System.Exception: Could not resolve a service of type 'Microsoft.AspNetCore.Identity.UserManager`1[[App.Domain.Entities.AppUser, App.Domain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]'

我在.NETCore2.2中使用了两个具有标识的自定义令牌提供程序。在迁移到3.1之后,我得到了这个异常

System.Exception: Could not resolve a service of type 'Microsoft.AspNetCore.Identity.UserManager`1[[App.Domain.Entities.AppUser, App.Domain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' for the parameter 'userManager' of method 'Configure' on type 'App.API.Startup'.
 ---> System.MissingMethodException: Method not found: 'Void Microsoft.AspNetCore.Identity.DataProtectorTokenProvider`1..ctor(Microsoft.AspNetCore.DataProtection.IDataProtectionProvider, Microsoft.Extensions.Options.IOptions`1<Microsoft.AspNetCore.Identity.DataProtectionTokenProviderOptions>)'.
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
}

更新:


经过一些调查,我注意到最新的
DataProtectionOrtokenProvider
有构造函数签名,其中包括
ILogger
,而我的(Microsoft.AspNetCore.Identity v2.2)只有
dataProtectionProvider
选项。我引用的是错误的包还是?

基本上,问题是许多
Microsoft.AspNetCore.
包现在被移动到
Microsoft.AspNetCore.App
framework,因此您删除了
Microsoft.AspNetCore.Identity
引用并将其添加到项目中

<ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

之后,它应该从共享文件夹解析它,所有框架dll都在共享文件夹中

<ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>