我正在尝试引用.Net 4.2.1编译的DLL(MCData.dll)以在.Net Core 2.1控制台应用程序(WebApi)中使用,但是一旦尝试访问DLL,就不断收到以下错误消息:
System.TypeInitializationException
HResult=0x80131534
Message=The type initializer for 'MCData.MCDataSettings' threw an exception.
Source=MCData.v6.11.0.0
StackTrace:
at MCData.MCDataSettings.set_AppDirectory(String value)
at WebAPI.Controllers.MembersController.Authenticate(String EmailAddress, String Password, String UserName) in T:\APIs\WebAPI\WebAPI\Controllers\MembersController.cs:line 64
at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext()
Inner Exception 1:
DllNotFoundException: Unable to load DLL 'mscorwks.dll' or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
找不到的dll在.Net Framework v2目录中,不能添加为参考。
我很困惑!