Cannot find Bitmap Class in Class Library (.NET Standard)

IIRawCodeII picture IIRawCodeII · Oct 13, 2017 · Viewed 19.6k times · Source

I want to make a Class Library (.NET Standard) and I'm using System.Drawing, but I get the error:

CS0246 C# The type or namespace name 'Bitmap' could not be found 
(are you missing a using directive or an assembly reference?)

I'm using .NET Standard 2.0.

Answer

Frederik Carlier picture Frederik Carlier · Nov 9, 2017

I'm the author of CoreCompat.System.Drawing. If you're on .NET Core 2.0, I'd recommend you'd move to System.Drawing.Common instead, which is the Microsoft-maintained implementation of System.Drawing for .NET Core.

If you're on Linux or macOS, make sure to install libgdiplus. On macOS, run brew install mono-libgdiplus; on Linux your package manager should provide you with a libgdiplus package.