Ошибки при попытке использовать System.Drawing в консольном приложении .Net Core - PullRequest
0 голосов
/ 09 сентября 2018

Я пытаюсь создать растровое изображение с System.Drawing.Common в консольном приложении .Net, работающем в Ubuntu 18.04, но как только я выполню код, оно покажет мне:

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 125
System.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()

Также я попытался сделать то, что было описано здесь . Но без успеха.

Спасибо за любую помощь.

1 Ответ

0 голосов
/ 09 сентября 2018

Вам необходимо установить библиотеку gdiplus с помощью менеджера пакетов. Например:

sudo apt-get install libgdiplus
...