Windows Nano Server / Servercore in .Net6 do not support System.Drawing
Are you seeing the following error messages?
- Error loading one of the Chrome assemblies (libcef.dll)
- Chrome Deployment Failure (error while loading libcef.dll) (203)
This is because System.Drawing is not included in Windows Nano Server, and Windows Servercore (.Net6).
The official .NET images for Windows are based on Nano Sever.
To work-around this issue, we suggest either:
- Build & deploy your project as
self-contained
(click for more information on this option) - Switch to Linux-based container images by changing the following property in your .csproj file:
<DockerDefaultTargetOS>Windows</DockerDefaultTargetOS>
to
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
You can then add Linux dependencies:
RUN apt update \ && apt install -y libgdiplus libxkbcommon-x11-0 libc6 libc6-dev libgtk2.0-0 libnss3 libatk-bridge2.0-0 libx11-xcb1 libxcb-dri3-0 libdrm-common libgbm1 libasound2 libxrender1 libfontconfig1 libxshmfence1
(The above dependencies are for Debian 11, though specific dependencies for Ubuntu, CentOs, Amazon Linux and more can be viewed here)