gpt4 book ai didi

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

转载 作者:太空狗 更新时间:2023-10-29 21:48:33 24 4
gpt4 key购买 nike

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

The type initializer for 'Gdip' threw an exception.   at System.Drawing.SafeNativeMethods.Gdip.GdipCreateBitmapFromScan0(Int32 width, Int32 height, Int32 stride, Int32 format, HandleRef scan0, IntPtr& bitmap)   at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)   at MidnightBot.Modules.AdminCommands.CreatePollAsync(String Term1, String Term2, String Description) in /home/MidnightBot/Modules/AdminCommands.cs:line 125System.DllNotFoundException: Unable to load DLL 'libgdiplus': The specified module could not be found.   at System.Runtime.InteropServices.FunctionWrapper`1.get_Delegate()   at System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& token, StartupInput& input, StartupOutput& output)   at System.Drawing.SafeNativeMethods.Gdip..cctor()

我也试着按照描述的去做here .但没有成功。

感谢您的帮助。

最佳答案

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

sudo apt-get install libgdiplus

关于c# - 尝试在 .Net Core 控制台应用程序中使用 System.Drawing 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52246949/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com