0

I started to move one of my projects from .NET Framework to .NET Core (3.1) and I got a compiler error.

I have a class working with Bitmap but it can't be found in System.Drawing. VS was so kind to tell me that it was moved to System.Drawing.Common which is in system.drawing.common.dll.

Well... I can't add it as a reference bc I can't find it anywhere.
Where can I add the System.Drawing.Common namespace to my project?

GSerg
  • 73,524
  • 17
  • 153
  • 317
BDevGW
  • 318
  • 2
  • 14

1 Answers1

3

Install the NuGet package for it

Some pointers and background discussion: https://www.hanselman.com/blog/HowDoYouUseSystemDrawingInNETCore.aspx the essence of which (in case of link rot) is:

  • Using System.Drawing of old was tied to Windows
  • MS repackaged things as System.Drawing.Common, put it on NuGet and it works on core/linux
  • You'll need to apt install some other dependencies on linux
  • Consider using ImageSharp instead if you're doing stuff like resizing images, filtering, distorting, drawing etc
Caius Jard
  • 69,583
  • 5
  • 45
  • 72