大佬教程收集整理的这篇文章主要介绍了c# – 在CentOS或Linux上使用Mono执行.Net应用程序,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我在Visual studio 2010上使用C#.Net中的WinForm开发了一个测试应用程序.现在,我想在Linux下使用Mono在CentOS上运行它.所以我尝试了下面的命令序列 –
[root@localhost TestLinux]# /usr/bin/mono ./Test.exe
我遇到了一个例外
Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.XplatUI ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Drawing.GDIPlus ---> System.DllNotFoundException: gdiplus.dll
at (wrapper managed-to-nativE) System.Drawing.GDIPlus:GdiplusStartup (ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
at System.Drawing.GDIPlus..cctor () [0x00000] --- End of inner exception stack trace ---
at <0x00000>>0x00000>><>Nown method>
at System.Drawing.Graphics.FromHdcInternal (IntPtr hdC) [0x00000]
at System.Windows.Forms.XplatUIX11.SetDisplay (IntPtr display_handlE) [0x00000]
at System.Windows.Forms.XplatUIX11..ctor () [0x00000]
at System.Windows.Forms.XplatUIX11.GeTinstance () [0x00000]
at System.Windows.Forms.XplatUI..cctor () [0x00000] --- End of inner exception stack trace ---
at <0x00000>>0x00000>><>Nown method>
at System.Windows.Forms.Application.EnableVisualStyles () [0x00000]
at Test.Program.Main () [0x00000]
在做一些研究的时候,我发现这是由于gdiplus.dll与其对应部分libgdiplus.so.0在linux上的@L_607_22@,需要将其条目放在ldconfig缓存中.
[root@localhost TestLinux]# ldconfig -p | grep libgdiplus
libgdiplus.so.0 (libc6) => /usr/lib/libgdiplus.so.0
输出清楚地显示libgdiplus.so.0在ldconfig缓存中,但程序仍然无法正常工作.我还尝试在应用程序配置中添加DllMap条目,如下所示
<>figuration>
s.dll" target="libgdiplus.so.0"/>
figuration>
如果有人在过去偶然发现这件事,请告诉我.
以上是大佬教程为你收集整理的c# – 在CentOS或Linux上使用Mono执行.Net应用程序全部内容,希望文章能够帮你解决c# – 在CentOS或Linux上使用Mono执行.Net应用程序所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。