简体   繁体   English

Microsoft.AspNetCore.Identity.EntityFrameworkCore 3.1.2 是否对 .NET 4.7.x 项目有效?

[英]Is Microsoft.AspNetCore.Identity.EntityFrameworkCore 3.1.2 valid for .NET 4.7.x projects?

I have a .NET console project targeting .NET Framework 4.7.2.我有一个面向 .NET Framework 4.7.2 的 .NET 控制台项目。

It uses Microsoft EntityFrameworkCore 3.1.2 and Microsoft.AspNetCore.Identity.EntityFrameworkCore 2.2.0 it fails at runtime with the following error :它使用 Microsoft EntityFrameworkCore 3.1.2 和 Microsoft.AspNetCore.Identity.EntityFrameworkCore 2.2.0 它在运行时失败并出现以下错误:

System.MissingMethodException
  HResult=0x80131513
  Message=Méthode introuvable : 'Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder`1.HasIndex(System.Linq.Expressions.Expression`1<System.Func`2<System.__Canon,System.Object>>)'.
  Source=Microsoft.AspNetCore.Identity.EntityFrameworkCore
  StackTrace:
   at Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserContext`5.<>c__DisplayClass20_0.<OnModelCreating>b__0(EntityTypeBuilder`1 b)
   at Microsoft.EntityFrameworkCore.ModelBuilder.Entity[TEntity](Action`1 buildAction)
   at Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserContext`5.OnModelCreating(ModelBuilder builder)
   at Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityDbContext`8.OnModelCreating(ModelBuilder builder)
   at RTE.Technologies.SafeProtect.Common.Data.DbContext.Core.IdentityDbContext.OnModelCreating(ModelBuilder modelBuilder) in D:\AzureDevops\SafeProtect.Common\SafeProtect.Common.Data\DbContext\Core\IdentityDbContext.cs:line 224
   at Microsoft.EntityFrameworkCore.Infrastructure.ModelCustomizer.Customize(ModelBuilder modelBuilder, DbContext context)
   at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder)
   at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.GetModel(DbContext context, IConventionSetBuilder conventionSetBuilder)
   at Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel()
   at Microsoft.EntityFrameworkCore.Internal.DbContextServices.get_Model()
   at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServicesBuilder.<>c.<TryAddCoreServices>b__7_3(IServiceProvider p)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
   at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies()
   at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider()
   at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies()
   at Microsoft.EntityFrameworkCore.DbContext.Set[TEntity]()
   at RTE.Technologies.SafeProtect.Common.Data.DbContext.Core.IdentityDbContext.RTE.Technologies.Common.EFCoreData.Interfaces.IDbContext<RTE.Technologies.SafeProtect.Common.Data.BusinessObjects.Models.WebAdminUser>.get_DbSet() in D:\AzureDevops\SafeProtect.Common\SafeProtect.Common.Data\DbContext\Core\IdentityDbContext.cs:line 156
   at RTE.Technologies.Common.EFCoreData.Repositories.Repository`1..ctor(IDbContext`1 context)
   at RTE.Technologies.Common.EFCoreData.Repositories.DisableableWithDateTimeRepository`1..ctor(IDbContext`1 context)
   at RTE.Technologies.SafeProtect.Common.Data.DbContext.Core.IdentityDbContext.get_WebAdminUserRepository() in D:\AzureDevops\SafeProtect.Common\SafeProtect.Common.Data\DbContext\Core\IdentityDbContext.cs:line 127
   at RTE.Technologies.SafeProtect.Common.Data.DataBridge.Core.IdentityDataBridge.GetAllUsersAdminEmailByCompanyId(Int32 companyId) in D:\AzureDevops\SafeProtect.Common\SafeProtect.Common.Data\DataBridge\Core\IdentityDataBridge.WebAdminUser.cs:line 69
   at RTE.Technologies.SafeProtect.Common.DummyConsole.Program.Main(String[] args) in D:\AzureDevops\SafeProtect.Common\SafeProtect.Common.DummyConsole\Program.cs:line 45

I would say that I should upgrade Microsoft.AspNetCore.Identity.EntityFrameworkCore to version 3.1.2 but I can't:我会说我应该将 Microsoft.AspNetCore.Identity.EntityFrameworkCore 升级到 3.1.2 版,但我不能:

Could not install package 'Microsoft.AspNetCore.Identity.EntityFrameworkCore 3.1.2'.无法安装包“Microsoft.AspNetCore.Identity.EntityFrameworkCore 3.1.2”。 You are trying to install this package into a project that targets '.NETFramework,Version=v4.7.2', but the package does not contain any assembly references or content files that are compatible with that framework.您正在尝试将此包安装到以“.NETFramework,Version=v4.7.2”为目标的项目中,但该包不包含任何与该框架兼容的程序集引用或内容文件。 For more information, contact the package author.有关更多信息,请联系软件包作者。

What are my options here are as I'm stuck with EF Core 3.1.2 that should be used in several projects targeting both .NET Core 3.0 and .NET Framework 4.7.2.我的选择是什么,因为我坚持使用 EF Core 3.1.2,它应该在针对 .NET Core 3.0 和 .NET Framework 4.7.2 的几个项目中使用。

您不能混合 3.x 和 2.x 依赖项

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将项目从.Net 4.6.1升级到4.7.x会导致WCF Reference.cs中出现错误 - Upgrading projects from .Net 4.6.1 to 4.7.x causes errors in WCF Reference.cs .NET 反射在 .NET 4.7.x 中比在 3.5 中慢 3 倍 - .NET reflection 3 times slower in .NET 4.7.x than in 3.5 .NET 4.7.x不会显示主窗口/ WPF升级到.NET到4.7.x可能导致无限循环 - Main window does not display with .NET 4.7.x / WPF upgrade to .NET to 4.7.x can result in infinite loops Microsoft.AspNetCore.Identity.EntityFrameworkCore.dll 中发生“System.InvalidOperationException” - 'System.InvalidOperationException' occurred in Microsoft.AspNetCore.Identity.EntityFrameworkCore.dll 无法投射 'Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1[Microsoft.AspNetCore.Identity.IdentityUser`1[System.Int32]]' - Cannot cast 'Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1[Microsoft.AspNetCore.Identity.IdentityUser`1[System.Int32]]' 实体类型&#39;Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin <string> &#39;需要定义一个密钥 - The entity type 'Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>' requires a key to be defined 没有注册 'Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityDbContext' 类型的服务 - No service for type 'Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityDbContext' has been registered 在 .Net 标准项目中使用 Microsoft.AspNetCore.Identity? - Use Microsoft.AspNetCore.Identity in .Net Standard Project? 扩展AspNetCore.Identity.EntityFrameworkCore.UserStore(V2.1.3) - Extend AspNetCore.Identity.EntityFrameworkCore.UserStore (V2.1.3) ASP .NET Core 标识 - Microsoft.AspNetCore.Identity.SignInManager:警告:用户未能提供正确的密码 - ASP .NET Core Identity - Microsoft.AspNetCore.Identity.SignInManager: Warning: User failed to provide the correct password
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM