8

我正在尝试在 Ubuntu 18.04 上运行的 .Net Core 控制台应用程序中使用System.Drawing.Common创建位图,但是一旦我执行代码,它就会向我显示:

'Gdip' 的类型初始化程序引发了异常。
   在 System.Drawing.SafeNativeMethods.Gdip.GdipCreateBitmapFromScan0(Int32 宽度,Int32 高度,Int32 步幅,Int32 格式,HandleRef scan0,IntPtr& 位图)
   在 System.Drawing.Bitmap..ctor(Int32 宽度,Int32 高度,PixelFormat 格式)
   在 MidnightBot.Modules.AdminCommands.CreatePollAsync(String Term1, String Term2, String Description) 在 /home/MidnightBot/Modules/AdminCommands.cs:line 125
System.DllNotFoundException:无法加载 DLL 'libgdiplus':找不到指定的模块。
   在 System.Runtime.InteropServices.FunctionWrapper`1.get_Delegate()
   在 System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& 令牌,StartupInput& 输入,StartupOutput& 输出)
   在 System.Drawing.SafeNativeMethods.Gdip..cctor()

我也尝试做这里描述的事情。但没有成功。

谢谢你的帮助。

4

1 回答 1

6

您需要使用包管理器安装 gdiplus 库。例如:

sudo apt-get install libgdiplus
于 2018-09-09T18:14:32.953 回答