使用 libgdiplus 與 IronOCR:設置指南
2022年1月19日
已更新 2024年10月20日
This article was translated from English: Does it need improvement?
TranslatedView the article in English
.NET Core 需要 libgdiplus 來使用 Microsoft 的 System.Drawing.Common nuget 套件。 如果在 MacOS 或 Linux 上找不到,您可能會遇到此異常:
- 未處理的例外。 System.DllNotFoundException: 無法從任何名稱中找到或加載本機庫:[ libgdiplus, libgdiplus.so ]
- 如果您看到 System.TypeInitializationException :'Gdip' 的類型初始化器引發了例外,請閱讀我們的System.Drawing.Common 在 NET6 中的指南。
Linux
Ubuntu,Debian
apt-get update && apt-get install -y apt-utils libgdiplus libc6-dev
Docker
將此行添加到 Docker 文件,它應該會運行。
RUN apt-get update && apt-get install -y apt-utils libgdiplus libc6-dev
macOS
未處理的例外。 System.DllNotFoundException:找不到或載入任何名稱的本機庫:[libgdiplus, libgdiplus.dylib]
- 作為開發人員,您可以將runtime.osx.10.10-x64.CoreCompat.System.Drawing NuGet 套件新增到您的 .NET 方案中,以將libgdiplus新增到您的專案。
- 或手動安裝
- brew update && brew install mono-libgdiplus
- 更多資訊:https://docs.microsoft.com/en-us/dotnet/core/install/macos#libgdiplus