[英]HelloWorld is successfully launched by Windows .NET but not by MONO
I've installed mono on my 64-bit Windows 7 using: 我使用以下命令在我的64位Windows 7上安装了mono:
in directory (without spaces in path) changed according to Jim Gomes' advice 在目录中(路径中没有空格)根据Jim Gomes的建议改变了
Successfully run first two examples 成功运行前两个示例
from Mono Basics article. 来自Mono Basics的文章。
But the 3d example "WinForms Hello World" is compiled without errors and run from Windows (by double-clicking in Windows Explorer) successfully but running: 但是三维示例“WinForms Hello World”编译时没有错误,并且从Windows(通过双击Windows资源管理器)成功运行但运行:
mono hello.exe
from "Mono-3.2.3 Command Prompt" window produces the errors listed below (note that first two examples including a window of second example was launched successfully from command prompt invoking through mono ...
) 从“Mono-3.2.3命令提示符”窗口生成下面列出的错误(请注意,前两个示例包括第二个示例的窗口是从命令提示符调用
mono ...
成功启动的mono ...
)
What is the problem and how to overcome it? 有什么问题以及如何克服它?
UPDATE UPDATE
According to mentioned article "Mono Basics" I compiled the 3d example "Winforms Hello World" with gmcs hello.cs -pkg:dotnet
. 根据上面提到的文章“Mono Basics”,我用
gmcs hello.cs -pkg:dotnet
编译了3d示例“Winforms Hello World”。
BTW, where is that dotnet
package located? 顺便说一句,
dotnet
包位于哪里?
Is it in directory with the same name? 它在同名目录中吗? I do not have a single dir with exactly such name
dotnet
under Mono-3.2.3 dir 在Mono-3.2.3目录下,我没有一个完全具有这样名称
dotnet
目录
The errors produced by running mono hello.exe
from "Mono-3.2.3 Command Prompt" 从“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
I have encountered this problem. 我遇到过这个问题。
I think this is mono's bug. 我认为这是单声道的错误。
If you installed mono in C:\\Program Files (x86)\\Mono-3.2.3\\etc\\mono
如果您在
C:\\Program Files (x86)\\Mono-3.2.3\\etc\\mono
Find the file C:\\Program Files (x86)\\Mono-3.2.3\\etc\\mono\\config
找到文件
C:\\Program Files (x86)\\Mono-3.2.3\\etc\\mono\\config
Change Line 29-30: 改变第29-30行:
<dllmap dll="gdiplus" target="/tmp/install/lib/libgdiplus.so" />
<dllmap dll="gdiplus.dll" target="/tmp/install/lib/libgdiplus.so" />
To: 至:
<dllmap dll="gdiplus" target="/tmp/install/lib/libgdiplus.so" os="!windows" />
<dllmap dll="gdiplus.dll" target="/tmp/install/lib/libgdiplus.so" os="!windows" />
And this problem will be solved. 这个问题将得到解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.