我正在嘗試在 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 125System.DllNotFoundException:無法加載 DLL 'libgdiplus':找不到指定的模塊。 在 System.Runtime.InteropServices.FunctionWrapper`1.get_Delegate() 在 System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& 令牌,StartupInput& 輸入,StartupOutput& 輸出) 在 System.Drawing.SafeNativeMethods.Gdip..cctor()我也嘗試做這里描述的事情。但沒有成功。
嘗試在 .Net Core 控制臺應用程序中使用 System.Drawing 時出錯
慕碼人8056858
2022-01-09 16:21:04