QRCoder 是一个支持 .NET Core 的用于生成二维码的开源库,在一个 .NET Core 项目中使用时,在 Windows 上可以正常生成二维码,发布到Linux Ubuntu服务器上运行时出现下面的错误:
System.TypeInitializationException: The type initializer for 'System.DrawingCore.GDIPlus' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'gdiplus': The specified module or one of its dependencies could not be found. (Exception from HRESULT: 0x8007007E) at System.DrawingCore.GDIPlus.GdiplusStartup(UInt64& token, GdiplusStartupInput& input, GdiplusStartupOutput& output) at System.DrawingCore.GDIPlus..cctor() --- End of inner exception stack trace --- at System.DrawingCore.GDIPlus.GdipCreateBitmapFromScan0(Int32 width, Int32 height, Int32 stride, PixelFormat format, IntPtr scan0, IntPtr& bmp) at System.DrawingCore.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format) at QRCoder.QRCode.GetGraphic(Int32 pixelsPerModule, Color darkColor, Color lightColor, Boolean drawQuietZones) at QRCoder.Base64QRCode.GetGraphic(Int32 pixelsPerModule)
请问如何解决这个问题?
1) apt install libgdiplus
2) cp /usr/lib/libgdiplus.so ~/.nuget/packages/qrcoder/1.3.1/lib/netstandard2.0
试过了,好使,感谢楼主
Centos 7
yum install libgdiplus-devel
OKKKkkkkk
非常感谢 !!! 刚好core 项目迁移 linux centos 碰到类似问题,我是 NPOI excel导出 碰到