Xamarin GTK on Linux: "DllNotFoundException: libglib-2.0-0.dll "



我正在尝试在新安装的Ubuntu 20.04.2 上运行Xamarin测试应用程序

在Windows10机器上,我正在克隆此回购:

https://github.com/jsuarezruiz/xamarin-forms-gtk-movies-sample

在Visual Studio 2019中编译,它在android和windows GTK 上完美运行

然后我将bin/Debug文件夹的内容复制到我的Linux机器上,并尝试用mono运行它,它会抛出一个异常:

Unhandled Exception:
System.DllNotFoundException: libglib-2.0-0.dll assembly:<unknown assembly> type:<unknown type> member:(null)
at (wrapper managed-to-native) GLib.Marshaller.g_utf16_to_utf8(char*,intptr,intptr,intptr,intptr&)
at GLib.Marshaller.StringToPtrGStrdup (System.String str) [0x00034] in <d973ca9f8b494b789fba7fe0ad040b14>:0 
at GLib.Global.set_ProgramName (System.String value) [0x00001] in <d973ca9f8b494b789fba7fe0ad040b14>:0 
at Gtk.Application.SetPrgname () [0x0000d] in <35293b6aa2744433b0e2f41f34e699d5>:0 
at Gtk.Application.Init () [0x00001] in <35293b6aa2744433b0e2f41f34e699d5>:0 
at Movies.GTK.Program.Main (System.String[] args) [0x00043] in <87211febe55c459f869a2b0842e037c3>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: libglib-2.0-0.dll assembly:<unknown assembly> type:<unknown type> member:(null)
at (wrapper managed-to-native) GLib.Marshaller.g_utf16_to_utf8(char*,intptr,intptr,intptr,intptr&)
at GLib.Marshaller.StringToPtrGStrdup (System.String str) [0x00034] in <d973ca9f8b494b789fba7fe0ad040b14>:0 
at GLib.Global.set_ProgramName (System.String value) [0x00001] in <d973ca9f8b494b789fba7fe0ad040b14>:0 
at Gtk.Application.SetPrgname () [0x0000d] in <35293b6aa2744433b0e2f41f34e699d5>:0 
at Gtk.Application.Init () [0x00001] in <35293b6aa2744433b0e2f41f34e699d5>:0 
at Movies.GTK.Program.Main (System.String[] args) [0x00043] in <87211febe55c459f869a2b0842e037c3>:0 

显然缺少一个";libglib-2-0.dll";,我不知道如何在Linux上安装,也不知道mono在哪里搜索它。到目前为止,我尝试安装mono-devel、mono-complete、gtk-sharp2、libglib2.0-dev

在搜索mono日志后,我注意到它试图访问windows特定的dll,所以我尝试设置库引用参数"复制本地";在这些库上为false:

  • atk-sharp
  • gdk-sharp
  • glade sharp
  • 油嘴滑舌
  • gtk dotnet
  • gtk锐
  • pango sharp

它在ubuntu 18.04.3 LTS 上工作

最新更新