.net core 3.1 can not use System.Drawing.Common on docker
amnotbusy opened this issue · comments
System.Windows.Extensions types are not supported on this platform.
This seems like a general problem with netcore. Let's see what the outcome of the following discussion will be: dotnet/runtime#1011
I was able to get the library to work on a Linux container running netcoreapp3.1 based on the guidance from this answer.
Summary: libgdiplus
couldn't be loaded at runtime, so I updated my dockerfile to install the following packages : apt-utils libgdiplus libc6-dev
@a57571735 does @pwninstein 's solution solve your problem?
I am considering this package and saw this discussion. I would be interested in knowing as well @a57571735 .
Can you try this:
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.5-buster-slim AS base
RUN apt-get update -y && apt-get install -y libc6-dev libgdiplus libx11-dev && apt-get clean && ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll
...
@pwninstein answer worked for me. Just adding a sample dockerfile which shows how it need to be defined.
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
WORKDIR /src
COPY "solution.sln" "solution.sln"
COPY "Project_1.csproj" "Project_1.csproj"
RUN dotnet restore "solution.sln"
COPY . .
WORKDIR /src/Project_1
RUN dotnet publish --no-restore -c Release -o /app
FROM build AS publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
RUN apt-get update && apt-get install -y apt-utils libgdiplus libc6-dev
ENTRYPOINT ["dotnet", "Project_1.dll"]
So this seems to be more a Docker/image problem (lib gdi missing), than a problem with QRCoder itself. Thus I'll close the issue. I you have a good idea how to integrate this information into the Wiki pages, let me know.