如何在OSX上运行Xamarin Studio在Debug目录下创建的exe文件?
本文关键字:创建 exe 文件 Debug OSX 运行 Studio Xamarin | 更新日期: 2023-09-27 18:12:41
我用c#学习了一段时间Xamarin Studio。我很困惑,因为我不能通过命令"mono test.ext"在调试目录下运行exe文件。下面是错误信息:
System.TypeInitializationException: An exception was thrown by the
type initializer for Gtk.Container ---> System.DllNotFoundException:
gtksharpglue-2
at (wrapper managed-to-native)
Gtk.Container:gtksharp_gtk_container_get_focus_child_offset ()
at Gtk.Container..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Gtk.Bin..ctor (IntPtr raw) [0x00000] in <filename unknown>:0
at Gtk.Window..ctor (WindowType type) [0x00000] in <filename unknown>:0
at MainWindow..ctor () [0x00000] in <filename unknown>:0
at BuildBoxTool.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for Gtk.Container ---> System.DllNotFoundException: gtksharpglue-2
at (wrapper managed-to-native) Gtk.Container:gtksharp_gtk_container_get_focus_child_offset ()
at Gtk.Container..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Gtk.Bin..ctor (IntPtr raw) [0x00000] in <filename unknown>:0
at Gtk.Window..ctor (WindowType type) [0x00000] in <filename unknown>:0
at MainWindow..ctor () [0x00000] in <filename unknown>:0
at BuildBoxTool.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0
我该怎么解决这个问题?谢谢~
系统。类型initializationexception抛出异常Gtk的类型初始化器。容器->系统。DllNotFoundException:gtksharpglue-2
默认情况下,Mono lib目录不会添加到任何全局dyld路径中,有关详细信息,请参阅dyld的手册页:
man dyld
~~~
DYLD_FALLBACK_LIBRARY_PATH
This is a colon separated list of directories that contain
libraries. It is used as the default location for libraries not
found in their install path. By default, it is set to
$(HOME)/lib:/usr/local/lib:/lib:/usr/lib.
~~~
所以要运行基于GTK#的'test.exe':
export DYLD_FALLBACK_LIBRARY_PATH="/Library/Frameworks/Mono.framework/Versions/Current/lib:/usr/local/lib:/usr/lib"
mono test.exe