2017-03-14 51 views
0

我是新來的.NetCore,目前正在使用幾天前發佈的Asp.NetCore 1.1構建Webapi應用程序。我引用了幾個類庫,它是在.net 4.5.2中開發的。System.IO.FileNotFoundException .NetCore 1.1

當我運行應用程序時,當我調用控制器時出現錯誤。請幫忙解決這個問題。

System.IO.FileNotFoundException:未能加載文件或程序 」,版本= 1.0.0.0,文化=中性 公鑰= 22b71681a01d2a47' 。系統找不到指定的文件 。文件名:」,版本= 1.0.0.0,文化=中立, 公鑰= 22b71681a01d2a47' 在 System.Signature.GetSignature(void *的pCorSig,的Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle,IRuntimeMethodInfo methodHandle,RuntimeType declaringType)在 系統。 Signature..ctor(IRuntimeMethodInfo methodHandle,RuntimeType declaringType)處 System.Reflection.RuntimeConstructorInfo.GetParametersNoCopy() System.Reflection.RuntimeConstructorInfo.get_Signature()處 Microsoft.Extensions System.Reflection.RuntimeConstructorInfo.GetParameters() .Internal.ActivatorUtilities.FindApplicableConstructor(類型 instanceType,Type [] argumentTypes,ConstructorIn FO & matchingConstructor,可空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的 鍵,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()

+0

任何機會,你可以提供的最小的解決方案,使我們能夠複製問題的代碼? – Ignas

回答

0

當你建立你有一些所謂的.net standard一個* .NET的核心應用。這個.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/

相關問題