在Mono中获取MissingDLL错误

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在Mono中获取MissingDLL错误相关的知识,希望对你有一定的参考价值。

所以我试图在CentOS上通过mono运行一个小型控制台应用程序,但我需要使用3个Visual-C ++库作为要求的一部分。

每当我尝试在CentOS上运行.net应用程序时,我都会得到一个异常,因为它缺少vsruntime140d.dll(我已经知道这是vs2015中c / c ++的.net程序集)

我已经将我的C ++应用程序配置为/ clr:safe,将他们的Windows SDK版本设置为Win10并将他们的平台工具集设置为VS 2017(我已经运行了,但我也尝试过2015)。在链接器中,我将其设置为Ignore Default Libraries / NODEFAULTLIB

我尝试在Windows中构建这些应用程序,然后将二进制文件和程序集复制到centos,然后运行mono Application.exe但它返回

Unhandled Exception: System.TypeInitializationException: The type initializer for '<Module>' threw an exception. ---> <CrtImplementationDetails>.ModuleLoadException: The C++ module failed to load during appdomain initialization. ---> System.DllNotFoundException: VCRUNTIME140D.dll at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal:Prelink (System.Reflection.MethodInfo) at <Module>.<CrtImplementationDetails>.LanguageSupport.ForceLoadRuntimeApis (<CrtImplementationDetails>.LanguageSupport* ) [0x00093] in <10c169d804e4480ab7903a570bc3de2b>:0 at <Module>.<CrtImplementationDetails>.LanguageSupport.InitializePerAppDomain (<CrtImplementationDetails>.LanguageSupport* ) [0x00012] in <10c169d804e4480ab7903a570bc3de2b>:0 at <Module>.<CrtImplementationDetails>.LanguageSupport._Initialize (<CrtImplementationDetails>.LanguageSupport* ) [0x00015] in <10c169d804e4480ab7903a570bc3de2b>:0 at <Module>.<CrtImplementationDetails>.LanguageSupport.Initialize (<CrtImplementationDetails>.LanguageSupport* ) [0x00010] in <10c169d804e4480ab7903a570bc3de2b>:0 --- End of inner exception stack trace --- at <Module>.<CrtImplementationDetails>.ThrowModuleLoadException (System.String errorMessage, System.Exception innerException) [0x00007] in <10c169d804e4480ab7903a570bc3de2b>:0 at <Module>.<CrtImplementationDetails>.LanguageSupport.Initialize (<CrtImplementationDetails>.LanguageSupport* ) [0x00026] in <10c169d804e4480ab7903a570bc3de2b>:0 at <Module>..cctor () [0x00008] in <10c169d804e4480ab7903a570bc3de2b>:0 --- End of inner exception stack trace --- at Application.Program.Main () [0x00029] in <2ff592459ad74d828ffa904fe73703f3>:0 [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for '<Module>' threw an exception. ---> <CrtImplementationDetails>.ModuleLoadException: The C++ module failed to load during appdomain initialization. ---> System.DllNotFoundException: VCRUNTIME140D.dll at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal:Prelink (System.Reflection.MethodInfo) at <Module>.<CrtImplementationDetails>.LanguageSupport.ForceLoadRuntimeApis (<CrtImplementationDetails>.LanguageSupport* ) [0x00093] in <10c169d804e4480ab7903a570bc3de2b>:0 at <Module>.<CrtImplementationDetails>.LanguageSupport.InitializePerAppDomain (<CrtImplementationDetails>.LanguageSupport* ) [0x00012] in <10c169d804e4480ab7903a570bc3de2b>:0 at <Module>.<CrtImplementationDetails>.LanguageSupport._Initialize (<CrtImplementationDetails>.LanguageSupport* ) [0x00015] in <10c169d804e4480ab7903a570bc3de2b>:0 at <Module>.<CrtImplementationDetails>.LanguageSupport.Initialize (<CrtImplementationDetails>.LanguageSupport* ) [0x00010] in <10c169d804e4480ab7903a570bc3de2b>:0 --- End of inner exception stack trace --- at <Module>.<CrtImplementationDetails>.ThrowModuleLoadException (System.String errorMessage, System.Exception innerException) [0x00007] in <10c169d804e4480ab7903a570bc3de2b>:0 at <Module>.<CrtImplementationDetails>.LanguageSupport.Initialize (<CrtImplementationDetails>.LanguageSupport* ) [0x00026] in <10c169d804e4480ab7903a570bc3de2b>:0 at <Module>..cctor () [0x00008] in <10c169d804e4480ab7903a570bc3de2b>:0 --- End of inner exception stack trace --- at Application.Program.Main () [0x00029] in <2ff592459ad74d828ffa904fe73703f3>:0

有没有人对如何让这个应用程序在CentOS上运行有任何想法?

答案

看到这个:Unable to use C++/CLI assembly in .NET

看起来像编译器回归。该线程中的建议是更新到VS2017 15.5预览2并查看它是否已消失。

以上是关于在Mono中获取MissingDLL错误的主要内容,如果未能解决你的问题,请参考以下文章

在 Spring Boot 中使用 Web Client Mono 获取 API 响应错误消息

如何在 Mono for android 中使用 Runnable

错误记录Flutter 混合开发获取 BinaryMessenger 报错 ( FlutterActivityAndFragmentDelegate.getFlutterEngine() )(代码片段

在 Mono 中获取 % 处理器时间

Android在活动视图中附加片段获取片段已添加错误

如何使用 Mono.Cecil 获取 IL 指令的源代码/行号