自从Heroku-16堆栈升级到Heroku-18堆栈后,引用System.Drawing.Common
以使用GDI +的.NET Core 2.2应用程序抛出错误:
System.TypeInitializationException: The type initializer for 'Gdip' threw an exception.
--->System.DllNotFoundException: Unable to load DLL 'libgdiplus': The specified module could not be found.
at System.Runtime.InteropServices.FunctionWrapper `1.get_Delegate()
at System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& token, StartupInput& input, StartupOutput& output)
at System.Drawing.SafeNativeMethods.Gdip..cctor()
这是因为未安装libc6-dev
(see this issue)。我正在使用heroku-buildpack-apt同时安装libgdiplus
和libc6-dev
),但似乎该软件包不再可用,在运行时只能在Heroku-18上使用在构建时(see this page)。
从构建日志中:
remote: -----> Fetching .debs for libc6-dev
remote: Reading package lists...
remote: Building dependency tree...
remote: Reinstallation of libc6-dev is not possible, it cannot be downloaded.
remote: 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
恢复为Heroku-16即可解决此问题。
我该如何在Heroku-18堆栈上进行这项工作?有人找到方法了吗?
答案 0 :(得分:0)
在Heroku支持下:
我真的很抱歉给您带来麻烦,但是在我看来这是不可能的。该软件包libc6-dev2.27-3ubuntu1意味着该软件包仅在构建时可用,而在运行时不可用。此外,如果您有一些要求,可以检查https://elements.heroku.com/buildpacks/eugeneotto/heroku-buildpack-secp256k1,但这不是官方支持的buildpack,我们对此不提供支持。
答案 1 :(得分:0)
.NET Core 3.x以及最新版本的System.Drawing.Common包含一些修复程序,这些修复程序消除了对libc6-dev的依赖。
如果无法安装libc6-dev,则可以尝试: