![](/img/trans.png)
[英]how can i get the directory of where i run my application exe file from?
[英]How can I run the exe file created by Xamarin Studio in Debug directory on OSX?
我有一段時間用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
我該怎么解決呢? 謝謝〜
System.TypeInitializationException:Gtk.Container的類型初始化器引發了一個異常---> System.DllNotFoundException:gtksharpglue-2
默認情況下,Mono lib目錄不會添加到任何全局dyld路徑,有關詳細信息,請查看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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.