.NET Core – gdiplus.dll not found in Linux
A few days ago there was an issue raised in my QrCoder project. It was reported that the code would not run under Linux, as the following error message would occur:
Unhandled Exception: System.TypeInitializationException: The type initializer for ‘System.Drawing.KnownColors’ threw an exception.
—> System.TypeInitializationException: The type initializer for ‘System.Drawing.GDIPlus’ threw an exception.
—> System.DllNotFoundException: Unable to load DLL ‘gdiplus.dll’: The specified module could not be found.
(Exception from HRESULT: 0x8007007E)
at System.Drawing.GDIPlus.GdiplusStartup(UInt64& token, GdiplusStartupInput& input,
[…]
However the error message had its origin not in my QrCoder, but in the interplay of the .NET core framework with the GDI Plus library. The .NET Core Framework tries to access “gdiplus.dll” when accessing “System.Drawing.GDIPlus”, which is simply not available on Linux.
First solution approach
First, ensure that GDI+ is installed at all. This can be done with the following shell command:
sudo apt-get install libgdiplus
If libgdiplus is installed, however, another important step is missing …
Link libgdiplus for .NET Core
Because the […]