为什么在Linux(WSL)上运行Gtk#应用程序时抛出System.DllNotFoundException?

1zmg4dgp  于 2023-01-01  发布在  Linux
关注(0)|答案(1)|浏览(335)

我在Windows上工作,使用GtkSharp库编译。我创建了Hello world应用程序,并为Windows和Ubuntu编译。在Windows应用程序上工作,但在Linux上我有例外

Unhandled exception. System.TypeInitializationException: The type initializer for 'Gtk.Application' threw an exception.
 ---> System.DllNotFoundException: Gtk: libgtk-3-0.dll, libgtk-3.so.0, libgtk-3.0.dylib, gtk-3.dll
   at GLibrary.Load(Library library)
   at Gtk.Application..cctor()
   --- End of inner exception stack trace ---
   at Gtk.Application.Init()
   at GtkSharp_Application2.Program.Main(String[] args) in I:\Проекты\Programs\GtkSharp Application2\GtkSharp Application2\Program.cs:line 9
Aborted

我不知道为什么它抛出,因为我在内置应用程序的所有库文件

-rwxrwxrwx 1 lisoveliy lisoveliy   306176 Apr 25  2022  AtkSharp.dll
-rwxrwxrwx 1 lisoveliy lisoveliy   120832 Apr 25  2022  CairoSharp.dll
-rwxrwxrwx 1 lisoveliy lisoveliy   259072 Apr 25  2022  GLibSharp.dll
-rwxrwxrwx 1 lisoveliy lisoveliy   610304 Apr 25  2022  GdkSharp.dll
-rwxrwxrwx 1 lisoveliy lisoveliy  1005568 Apr 25  2022  GioSharp.dll
-rwxrwxrwx 1 lisoveliy lisoveliy   142840 Dec 31 12:59 'GtkSharp Application2'
-rwxrwxrwx 1 lisoveliy lisoveliy    32650 Dec 31 12:59 'GtkSharp Application2.deps.json'
-rwxrwxrwx 1 lisoveliy lisoveliy     5120 Dec 31 12:59 'GtkSharp Application2.dll'
-rwxrwxrwx 1 lisoveliy lisoveliy    10500 Dec 31 12:59 'GtkSharp Application2.pdb'
-rwxrwxrwx 1 lisoveliy lisoveliy      179 Dec 31 12:59 'GtkSharp Application2.runtimeconfig.json'
-rwxrwxrwx 1 lisoveliy lisoveliy  3370496 Apr 25  2022  GtkSharp.dll
-rwxrwxrwx 1 lisoveliy lisoveliy   841872 Oct 23 21:15  Microsoft.CSharp.dll
-rwxrwxrwx 1 lisoveliy lisoveliy  1232520 Oct 23 21:15  Microsoft.VisualBasic.Core.dll
-rwxrwxrwx 1 lisoveliy lisoveliy    18048 Oct 23 20:52  Microsoft.VisualBasic.dll
-rwxrwxrwx 1 lisoveliy lisoveliy    24704 Oct 23 21:15  Microsoft.Win32.Primitives.dll
-rwxrwxrwx 1 lisoveliy lisoveliy    59008 Oct 23 21:15  Microsoft.Win32.Registry.dll
-rwxrwxrwx 1 lisoveliy lisoveliy   203776 Apr 25  2022  PangoSharp.dll

我使用WSL,但我认为问题不是由这个引起的。
我期待运行应用程序的Linux,但那不工作.

sczxawaw

sczxawaw1#

我通过安装gtk包sudo apt install libgtk-3-0修复了这个问题

相关问题