从.net core 2.2升级到3.1后,我在下面遇到异常。开发时并没有发生这种情况。
运行时:docker mcr.microsoft.com/dotnet/core/aspnet:latest
Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.EntityFrameworkCore.Relational, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
File name: 'Microsoft.EntityFrameworkCore.Relational, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
at System.Reflection.RuntimeMethodInfo.get_ReturnType()
at AspectCore.Extensions.Reflection.MethodReflector.GetDisplayName(MethodInfo method)
at AspectCore.Extensions.Reflection.MethodReflector..ctor(MethodInfo reflectionInfo)
at AspectCore.Extensions.Reflection.MethodReflector.<>c__DisplayClass0_0.<Create>g__CreateInternal|0(Pair`2 item)
at AspectCore.Extensions.Reflection.ReflectorCacheUtils`2.<>c__DisplayClass1_0.<GetOrAdd>b__0(TMemberInfo k)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at AspectCore.Extensions.Reflection.MethodReflector.Create(MethodInfo reflectionInfo, CallOptions callOption)
at AspectCore.Extensions.Reflection.ReflectorExtensions.GetReflector(MethodInfo method, CallOptions callOption)
at AspectCore.Extensions.Reflection.ReflectorExtensions.GetReflector(MethodInfo method)
at AspectCore.DynamicProxy.ReflectionUtils.IsNonAspect(MethodInfo methodInfo)
at AspectCore.DynamicProxy.OverwriteAspectValidationHandler.Invoke(AspectValidationContext context, AspectValidationDelegate next)
at AspectCore.DynamicProxy.AspectValidatorBuilder.<>c__DisplayClass1_1.<.ctor>b__2(AspectValidationContext method)
at AspectCore.DynamicProxy.CacheAspectValidationHandler.<>c__DisplayClass4_0.<Invoke>b__0(AspectValidationContext tuple)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at AspectCore.DynamicProxy.CacheAspectValidationHandler.Invoke(AspectValidationContext context, AspectValidationDelegate next)
at AspectCore.DynamicProxy.AspectValidatorBuilder.<>c__DisplayClass1_1.<.ctor>b__2(AspectValidationContext method)
at AspectCore.DynamicProxy.AspectValidator.Validate(MethodInfo method, Boolean isStrictValidation)
at AspectCore.DynamicProxy.AspectValidatorExtensions.Validate(IAspectValidator aspectValidator, Type type, Boolean isStrictValidation)
at AspectCore.DependencyInjection.ServiceValidator.TryValidate(ServiceDefinition definition, Type& implementationType)
at AspectCore.DependencyInjection.ServiceTable.MakProxyService(ServiceDefinition service)
at AspectCore.DependencyInjection.ServiceTable.Populate(IEnumerable`1 services)
at AspectCore.DependencyInjection.ServiceResolver..ctor(IServiceContext serviceContext)
at AspectCore.DependencyInjection.ServiceContainerBuildExtensions.Build(IServiceContext serviceContext)
at AspectCore.Extensions.DependencyInjection.ServiceContextProviderFactory.CreateServiceProvider(IServiceContext contextBuilder)
at Microsoft.Extensions.Hosting.Internal.ServiceFactoryAdapter`1.CreateServiceProvider(Object containerBuilder)
at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at WLYD.Titan.Job.Program.Main(String[] args)
然后安装该包Microsoft.EntityFrameworkCore.Relational。有效吗?!
我想知道为什么!除dapper外,我根本不使用efcore。