System.Drawing.Common Alternatives (.NET 7 & Non-Windows)

In .NET6 and .NET7, Microsoft has stopped supporting Linux and MacOs, and System.Drawing.Common will only work on Windows.

Workarounds to Avoid system.drawing.common is not supported on this platform

  1. Implement System.drawing.common is not possible on Linux and MacOs platform for .NET6 and .NET7
  2. Get exception message of system.drawing.common is not supported on this platform
  3. Set System.Drawing.EnableUnixSupport runtime configuration to true for .NET6
  4. Support no longer available in .NET7 too
  5. Use IronSoftware.Drawing open-source library to replace System.Drawing.Common for NET7
  6. On non-Windows operating systems, a TypeInitializationException exception is thrown with PlatformNotSupportedException as the inner exception.
  7. In .NET 6, the platform analyzer emits compile-time warnings when referencing code is compiled for non-Windows operating systems. In addition, the following run-time exception is thrown unless you set a configuration option:
System.TypeInitializationException : The type initializer for 'Gdip' threw an exception.

    ---- System.PlatformNotSupportedException : System.Drawing.Common is not supported on non-Windows platforms.

Temporary work-around in .NET6:

Enable support for non-Windows platforms by setting the System.Drawing.EnableUnixSupport runtime configuration switch to true in the runtimeconfig.json file:


    "runtimeOptions": {

        "configProperties": {

            "System.Drawing.EnableUnixSupport": true




Add the following code to the beginning of your code:

System.AppContext.SetSwitch("System.Drawing.EnableUnixSupport", true);


With the release of .NET7, Microsoft has removed the work-around - completely removing support for System.Drawing.Common in Linux and MacOs.

Iron Software has released an open-source replacement to System.Drawing.Common, call IronSoftware.Drawing. [NuGet] [GitHub]

To learn more: