Site icon Ryadel

ASP.NET Core on Linux - Unable to load DLL libgdiplus - how to fix it

How to Deploy a ASP.NET Core 2 Web Application to Linux CentOS - Tutorial

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:

If you're not using CentOS, you might have to use apt-get instead of yum:

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.

 

Exit mobile version