.NET Core and System.Drawing

Solution 1:

I know this is old, but there is now a port of the library called System.Drawing.Common. Try installing that one with NuGet.

To make this possible, there is a metapackage called Windows Compatibility Pack. However, this metapackage includes many, many Windows related APIs (distributed as packages).

Source: https://developers.de/2018/01/22/how-to-use-system-drawing-in-net-core/

Solution 2:

Add NuGet reference Microsoft.Windows.Compatibility

Notice: mark "Include prerelease"

Of course, it works only if prerelease packages are OK for you.

Solution 3:

System.Drawing is not a good option with ASP.NET

If you want graphics manipulation i suggest to use ImageSharp (https://github.com/JimBobSquarePants/ImageSharp) on .Net Core or ImageProcessor (http://imageprocessor.org/) / ImageResizer (https://imageresizing.net/) on .Net Framework

Also, if you really need to use System.Drawing change frameworks in your project.json to netstandard1.6 and add in dependencies "NETStandard.Library": "1.6.1"

Solution 4:

When you want to use asp.net core on .NET Full Framework only you can reference the old class libraries like this

{
  "version": "1.0.0-*",

  "frameworks": {
    "net452": {
      "dependencies": {
      },
      "frameworkAssemblies": {
        "System.Drawing": "4.0.0.0",
      }


    }
  }
}