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.
The Solution
Luckily enough, the fix was really simple: I just had to install the GDI+ package with the following command:
1 |
> sudo yum install libgdiplus |
If you're not using CentOS, you might have to use apt-get instead of yum:
1 |
> sudo apt-get install libgdiplus |
Once I did that, the ASP.NET Core web app started to work without other issues.
Conclusion
That's it! I hope that this post will help other developers to fix this GDI+ problem for good.