Today I faced a minor issue while trying to publish my ASP.NET Core project on my Linux CentOS production machine. The error I got was the following:
Unable to load DLL libgdiplus – gdiplus.dll not found
As soon as I read it, I was immediately aware what the problem was: since my project is widely using the GDI Plus library, the .NET Core Framework tries to access the System.Drawing.GDIPlus namespace… which doesn’t exist natively on Linux.
Luckily enough, the fix was really simple: I just had to install the GDI+ package with the following command:
> sudo yum install libgdiplus
If you’re not using CentOS, you might have to use apt-get instead of yum:
> sudo apt-get install libgdiplus
Once I did that, the ASP.NET Core web app started to work without other issues.
That’s it! I hope that this post will help other developers to fix this GDI+ problem for good.