我使用以下方法在64位Windows 7上安装了mono:
(路径中没有空格)根据Jim Gomes' advice
更改成功运行前两个例子
来自Mono Basics文章。
但是3D示例" WinForms Hello World"编译时没有错误,并从Windows(通过双击Windows资源管理器)成功运行但运行:
mono hello.exe
来自" Mono-3.2.3命令提示符"窗口产生下面列出的错误
(请注意,前两个示例包括第二个示例的窗口是从命令提示符调用mono ...
成功启动的)
问题是什么以及如何克服它?
更新
根据上面提到的文章"Mono Basics",我编写了3d示例" Winforms Hello World"与gmcs hello.cs -pkg:dotnet
。
BTW,dotnet
包裹在哪里?
它在同名目录中吗?在Mono-3.2.3目录下我没有一个名字dotnet
的单一目录
从" Mono-3.2.3命令提示符"
运行mono hello.exe
产生的错误
Unhandled Exception:
System.TypeInitializationException:
An exception was thrown by the type initializer for
System.Windows.Forms.WindowsFormsSynchronizationContext
---> System.TypeInitializationException:
An exception was thrown by the type initializer for
System.Windows.Forms.ThemeEngine ---> System.TypeInitializationException:
An exception was thrown by the type initializer for
System.Windows.Forms.ThemeWin32Classic
---> System.TypeInitializationException:
An exception was thrown by the type initializer for System.Drawing.KnownColors
---> System.TypeInitializationException:
An exception was thrown by the type initializer for System.Drawing.GDIPlus
---> System.DllNotFoundException: /tmp/install/lib/libgdiplus.so at
(wrapper managed-to-native) System.Drawing.GDIPlus:GdiplusStartup
(ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
at System.Drawing.GDIPlus..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Drawing.KnownColors..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Drawing.Color.get_Black () [0x00000] in <filename unknown>:0
at System.Windows.Forms.ThemeWin32Classic..cctor () [0x00000] in <filename unk
nown>:0
--- End of inner exception stack trace ---
at System.Windows.Forms.ThemeEngine..cctor () [0x00000] in <filename unknown>:
0
--- End of inner exception stack trace ---
at System.Windows.Forms.SystemInformation.get_MenuAccessKeysUnderlined () [0x0
0000] in <filename unknown>:0
at System.Windows.Forms.Control..ctor () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:.ctor ()
at System.Windows.Forms.WindowsFormsSynchronizationContext..cctor () [0x00000]
in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Windows.Forms.Control..ctor () [0x00000] in <filename unknown>:0
at System.Windows.Forms.ScrollableControl..ctor () [0x00000] in <filename unkn own>:0
at System.Windows.Forms.ContainerControl..ctor () [0x00000] in <filename unkno wn>:0
at System.Windows.Forms.Form..ctor () [0x00000] in <filename unknown>:0
at HelloWorld..ctor () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) HelloWorld:.ctor ()
at HelloWorld.Main () [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException:
An exception was thrown by the type initializer for
System.Windows.Forms.WindowsFormsSynchronizationContext
---> System.TypeInitializationException:
An exception was thrown by the type initializer for
System.Windows.Forms.ThemeEngine
---> System.TypeInitializationException:
An exception was thrown by the type initializer for
System.Windows.Forms.ThemeWin32Classic
---> System.TypeInitializationException:
An exception was thrown by the type initializer for
System.Drawing.KnownColors
---> System.TypeInitializationException:
An exception was thrown by the type initializer for
System.Drawing.GDIPlus
---> System.DllNotFoundException: /tmp/install/lib/libgdiplus.so
at (wrapper managed-to-native) System.Drawing.GDIPlus:GdiplusStartup (ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
at System.Drawing.GDIPlus..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Drawing.KnownColors..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Drawing.Color.get_Black () [0x00000] in <filename unknown>:0
at System.Windows.Forms.ThemeWin32Classic..cctor () [0x00000] in <filename unk
nown>:0
--- End of inner exception stack trace ---
at System.Windows.Forms.ThemeEngine..cctor () [0x00000] in <filename unknown>:
0
--- End of inner exception stack trace ---
at System.Windows.Forms.SystemInformation.get_MenuAccessKeysUnderlined () [0x0
0000] in <filename unknown>:0
at System.Windows.Forms.Control..ctor () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:.ctor ()
at System.Windows.Forms.WindowsFormsSynchronizationContext..cctor () [0x00000]
in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Windows.Forms.Control..ctor () [0x00000] in <filename unknown>:0
at System.Windows.Forms.ScrollableControl..ctor () [0x00000] in <filename unkn
own>:0
at System.Windows.Forms.ContainerControl..ctor () [0x00000] in <filename unkno
wn>:0
at System.Windows.Forms.Form..ctor () [0x00000] in <filename unknown>:0
at HelloWorld..ctor () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) HelloWorld:.ctor ()
at HelloWorld.Main () [0x00000] in <filename unknown>:0
答案 0 :(得分:5)
我遇到过这个问题。
我认为这是单声道的错误。
如果您在C:\Program Files (x86)\Mono-3.2.3\etc\mono
找到文件C:\Program Files (x86)\Mono-3.2.3\etc\mono\config
更改第29-30行:
<dllmap dll="gdiplus" target="/tmp/install/lib/libgdiplus.so" />
<dllmap dll="gdiplus.dll" target="/tmp/install/lib/libgdiplus.so" />
要:
<dllmap dll="gdiplus" target="/tmp/install/lib/libgdiplus.so" os="!windows" />
<dllmap dll="gdiplus.dll" target="/tmp/install/lib/libgdiplus.so" os="!windows" />
这个问题将会解决。