C# HelloWorld是通过Windows.NET而不是MONO成功启动的

C# HelloWorld是通过Windows.NET而不是MONO成功启动的,c#,.net,winforms,mono,C#,.net,Winforms,Mono,我在64位Windows 7上安装了mono,使用的是: mono-3.2.3-gtksharp-2.12.11-win32-0.exe 从 在目录中(路径中没有空格)根据更改 成功运行前两个示例 控制台你好,世界 Gtk#你好,世界 来自文章 但是3d示例“WinForms Hello World”编译时没有错误,并且在Windows中运行(通过双击Windows资源管理器)成功,但正在运行: mono hello.exe 从“Mono-3.2.3命令提示符”窗口产生下列错误 (注意

我在64位Windows 7上安装了mono,使用的是:

  • mono-3.2.3-gtksharp-2.12.11-win32-0.exe
在目录中(路径中没有空格)根据更改

成功运行前两个示例

  • 控制台你好,世界
  • Gtk#你好,世界
来自文章

但是3d示例“WinForms Hello World”编译时没有错误,并且在Windows中运行(通过双击Windows资源管理器)成功,但正在运行:

mono hello.exe
从“Mono-3.2.3命令提示符”窗口产生下列错误 (注意,前两个示例(包括第二个示例的窗口)通过
mono…
从命令提示符调用成功启动)

问题是什么?如何克服

更新
根据上面提到的文章,我用
gmcs Hello.cs-pkg:dotnet
编译了3d示例“Winforms Hello World”

顺便问一下,那个
dotnet
包在哪里?
它在同名目录中吗?在Mono-3.2.3目录下,我没有一个目录的名称与dotnet完全相同

从“mono-3.2.3命令提示符”运行
mono hello.exe
时产生的错误

未处理的异常:
System.TypeInitializationException:
的类型初始值设定项引发了异常
System.Windows.Forms.WindowsForms同步上下文
--->System.TypeInitializationException:
的类型初始值设定项引发了异常
System.Windows.Forms.ThemeEngine-->System.TypeInitialization异常:
的类型初始值设定项引发了异常
System.Windows.Forms.ThemeWin32Classic
--->System.TypeInitializationException:
System.Drawing.KnownColors的类型初始值设定项引发异常
--->System.TypeInitializationException:
System.Drawing.GDIPlus的类型初始值设定项引发异常
--->System.DllNotFoundException:/tmp/install/lib/libgdiplus.so位于
(包装器管理为本机)System.Drawing.GDIPlus:GdiplusStartup
(ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
位于System.Drawing.GDIPlus..cctor()[0x00000]中:0
---内部异常堆栈跟踪的结束---
位于System.Drawing.KnownColors..cctor()[0x00000]中:0
---内部异常堆栈跟踪的结束---
在System.Drawing.Color.get_Black()[0x00000]中:0
0中的System.Windows.Forms.ThemeWin32Classic..cctor()[0x00000]处
---内部异常堆栈跟踪的结束---
在System.Windows.Forms.ThemeEngine..cctor()[0x00000]中:
0
---内部异常堆栈跟踪的结束---
在System.Windows.Forms.SystemInformation.get_menuaccesskeysbarrelated()[0x0
0000]英寸:0
位于:0中的System.Windows.Forms.Control..ctor()[0x00000]处
在(包装器远程处理与检查调用)System.Windows.Forms.Control:.ctor()
位于System.Windows.Forms.WindowsFormsSynchronizationContext..cctor()[0x00000]
年:0
---内部异常堆栈跟踪的结束---
位于:0中的System.Windows.Forms.Control..ctor()[0x00000]处
在System.Windows.Forms.ScrollableControl..ctor()[0x00000]中:0
在System.Windows.Forms.ContainerControl..ctor()[0x00000]中:0
位于:0中的System.Windows.Forms.Form..ctor()[0x00000]处
在HelloWorld..ctor()[0x00000]处,位于:0
在(带检查的包装器远程处理调用)HelloWorld:.ctor()
在HelloWorld.Main()[0x00000]中:0
[错误]致命的未处理异常:System.TypeInitializationException:
的类型初始值设定项引发了异常
System.Windows.Forms.WindowsForms同步上下文
--->System.TypeInitializationException:
的类型初始值设定项引发了异常
System.Windows.Forms.ThemeEngine
--->System.TypeInitializationException:
的类型初始值设定项引发了异常
System.Windows.Forms.ThemeWin32Classic
--->System.TypeInitializationException:
的类型初始值设定项引发了异常
System.Drawing.Known颜色
--->System.TypeInitializationException:
的类型初始值设定项引发了异常
System.Drawing.GDIPlus
--->System.DllNotFoundException:/tmp/install/lib/libgdiplus.so
在(包装器管理为本机)System.Drawing.GDIPlus:GdiplusStartup(ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
位于System.Drawing.GDIPlus..cctor()[0x00000]中:0
---内部异常堆栈跟踪的结束---
位于System.Drawing.KnownColors..cctor()[0x00000]中:0
---内部异常堆栈跟踪的结束---
在System.Drawing.Color.get_Black()[0x00000]中:0
0中的System.Windows.Forms.ThemeWin32Classic..cctor()[0x00000]处
---内部异常堆栈跟踪的结束---
在System.Windows.Forms.ThemeEngine..cctor()[0x00000]中:
0
---内部异常堆栈跟踪的结束---
在System.Windows.Forms.SystemInformation.get_menuaccesskeysbarrelated()[0x0
0000]英寸:0
位于:0中的System.Windows.Forms.Control..ctor()[0x00000]处
在(包装器远程处理与检查调用)System.Windows.Forms.Control:.ctor()
位于System.Windows.Forms.WindowsFormsSynchronizationContext..cctor()[0x00000]
年:0
---内部异常堆栈跟踪的结束---
位于:0中的System.Windows.Forms.Control..ctor()[0x00000]处
在System.Windows.Forms.ScrollableControl..ctor()[0x00000]中:0
在System.Windows.Forms.ContainerControl..ctor()[0x00000]中:0
位于:0中的System.Windows.Forms.Form..ctor()[0x00000]处
在HelloWorld..ctor()[0x00000]处,位于:0
在(带检查的包装器远程处理调用)HelloWorld:.ctor()
在HelloWorld.Main()[0x00000]中:0

我遇到了这个问题

我想这是mono的错误

如果您在
C:\ProgramFiles(x86)\mono-3.2.3\etc\mono中安装了mono

查找文件
C:\ProgramFiles(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" />
<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" />