尝试在.Net Core控制台应用程序中使用System.Drawing时出错

Twe*_*nty 6 c# dllnotfoundexception .net-core ubuntu-18.04

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

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

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

谢谢你的帮助。

Nin*_*rry 6

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

sudo apt-get install libgdiplus
Run Code Online (Sandbox Code Playgroud)