System.IO.FileNotFoundException .NetCore 1.1

时间:2017-03-14 05:52:44

标签: asp.net-core .net-core asp.net-core-1.1 .net-core-1.1

我是.NetCore的新手,目前正在使用几天前发布的Asp.NetCore 1.1构建一个Webapi应用程序。我引用了几个在.net 4.5.2

中开发的类库

当我运行应用程序时,我在调用控制器时遇到错误。请帮忙解决这个问题。

  

System.IO.FileNotFoundException:无法加载文件或程序集   ',版本= 1.0.0.0,文化=中立,   公钥= 22b71681a01d2a47' 。系统找不到该文件   指定。文件名:',Version = 1.0.0.0,Culture = neutral,   PublicKeyToken = 22b71681a01d2a47'at   System.Signature.GetSignature(Void * pCorSig,Int32 cCorSig,   RuntimeFieldHandleInternal fieldHandle,IRuntimeMethodInfo   methodHandle,RuntimeType declaringType)at   System.Signature..ctor(IRuntimeMethodInfo methodHandle,RuntimeType   声明类型)   System.Reflection.RuntimeConstructorInfo.get_Signature()at   System.Reflection.RuntimeConstructorInfo.GetParametersNoCopy()at   System.Reflection.RuntimeConstructorInfo.GetParameters()at   Microsoft.Extensions.Internal.ActivatorUtilities.FindApplicableConstructor(类型   instanceType,Type [] argumentTypes,ConstructorInfo&amp;   matchingConstructor,Nullable 1[]& parameterMap) at Microsoft.Extensions.Internal.ActivatorUtilities.CreateFactory(Type instanceType, Type[] argumentTypes) at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateFactory(Type instanceType, Type[] argumentTypes) at System.Collections.Concurrent.ConcurrentDictionary 2.GetOrAdd(TKey   key,Func 2 valueFactory) at Microsoft.AspNetCore.Mvc.Internal.TypeActivatorCache.CreateInstance[TInstance](IServiceProvider serviceProvider, Type implementationType) at Microsoft.AspNetCore.Mvc.Controllers.DefaultControllerFactory.CreateController(ControllerContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextResourceFilter>d__22.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ResourceExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeAsync>d__20.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.<Invoke>d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame 1.d__2.MoveNext()

1 个答案:

答案 0 :(得分:0)

当您构建* .NET Core应用程序时,您会遇到名为.net standard的内容。此.NET标准是所有.NET平台必须实现的一组API。这统一了.NET平台并防止了未来的碎片化。

根据此表:

alt

.NET Framework 4.5.2应与.NET Standard 1.2.NET Standard 1.3兼容。

如果此标准有效,请尝试将dll的定位版本更改为.NET Framework 4.5.1.NET Framework 4.6

有关NET标准的有用链接:https://blogs.msdn.microsoft.com/dotnet/2016/09/26/introducing-net-standard/