加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

c# – 在CentOS或Linux上使用Mono执行.Net应用程序

发布时间:2020-12-13 18:57:01 所属栏目:Linux 来源:网络整理
导读:我在Visual Studio 2010上使用C#.Net中的WinForm开发了一个测试应用程序.现在,我想在Linux下使用Mono在CentOS上运行它.所以我尝试了下面的命令序列 [root@localhost TestLinux]# /usr/bin/mono ./Test.exe 我遇到了一个例外 Unhandled Exception: System.Typ

我在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> 

在做一些研究的时候,我发现这是由于gdiplus.dll与其对应部分libgdiplus.so.0在linux上的链接,需要将其条目放在ldconfig缓存中.

[root@localhost TestLinux]# ldconfig -p | grep libgdiplus
    libgdiplus.so.0 (libc6) => /usr/lib/libgdiplus.so.0

输出清楚地显示libgdiplus.so.0在ldconfig缓存中,但程序仍然无法正常工作.我还尝试在应用程序配置中添加DllMap条目,如下所示

如果有人在过去偶然发现这件事,请告诉我.

最佳答案
您已错误地追踪错误.
您的单声道版本不支持EnableVisualStyles.
升级到支持它的版本(据我记得它是> = 2.9)或尝试在.net应用程序中禁用此功能,这将导致“不太好的ui元素”.
对我来说,它工作,因为我正在研究gentoo.
突然,在出现之后,我的单声道应用程序不再崩溃了.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读