簡體   English   中英

HelloWorld由Windows .NET成功啟動,但未由MONO成功啟動

[英]HelloWorld is successfully launched by Windows .NET but not by MONO

我使用以下命令在我的64位Windows 7上安裝了mono:

在目錄中(路徑中沒有空格)根據Jim Gomes的建議改變了

成功運行前兩個示例

  • 控制台Hello World
  • Gtk #Hello World

來自Mono Basics的文章。

但是三維示例“WinForms Hello World”編譯時沒有錯誤,並且從Windows(通過雙擊Windows資源管理器)成功運行但運行:

mono hello.exe

從“Mono-3.2.3命令提示符”窗口生成下面列出的錯誤(請注意,前兩個示例包括第二個示例的窗口是從命令提示符調用mono ...成功啟動的mono ...

有什么問題以及如何克服它?

UPDATE
根據上面提到的文章“Mono Basics”,我用gmcs hello.cs -pkg:dotnet編譯了3d示例“Winforms Hello World”。

順便說一句, 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

我遇到過這個問題。

我認為這是單聲道的錯誤。

如果您在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" />

這個問題將得到解決。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM