c# - 在 Mono 中获取 MissingDLL 错误

标签 c# .net visual-c++ mono centos

所以我想在 CentOS 上通过单声道运行一个小型控制台应用程序,但我需要使用 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,看看它是否消失了。

关于c# - 在 Mono 中获取 MissingDLL 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47641258/

相关文章:

c# - EF6 : Configure complex mapping for entities (code first)

c++ - 无法访问 vc++10 中的模板私有(private)继承

c# - 处置后调用 MemoryStream.ToArray() 是否危险?

c# - 在 Xamarin 表单 C# 中检查互联网连接的后台服务

c# - 在 richtextbox 中突出显示单词

c# - 想要替代 Response.End()

c# - 测试模拟对象构造函数

.net - 如何在部分信任环境(无 FileIOPermission)中访问我的程序集版本号

c++ - 如何以编程方式读取/写入 ISO 文件的某些 LBA 上的扇区?

c++ - Windows 密码过滤器 DLL 未加载