2

I am trying to use System.Drawing.Bitmap from a .NET Core 3.1 library.

According to docs https://learn.microsoft.com/en-us/dotnet/api/system.drawing.bitmap?view=dotnet-plat-ext-3.1 the type is available in the version 3.

When I try to build the library using Bitmap I got the error:

error CS1069: The type name 'Bitmap' could not be found in the namespace 'System.Drawing'.
This type has been forwarded to assembly 'System.Drawing.Common, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
Consider adding a reference to that assembly

How can I create a .NET Core 3 class library using that type?

OBS: Using that type from a .NET Core WinForms work without any problem. (and there is no need to reference the nuget System.Drawing.Common since the type is already in the SDK).

Vinicius Jarina
  • 797
  • 5
  • 16
  • So the only way is to reference the NuGet ? @AlexeiLevenkov – Vinicius Jarina May 23 '20 at 04:55
  • @Lex Li https://stackoverflow.com/questions/54335778/cant-find-image-class-in-system-drawing-under-net-core-2-2 this is not the same question since I am using .NET Core 3.1 and according to the docs the System.Drawing.Bitmap is available on .NET Core 3.1 I tried to use `. But didn't work. AFAIK using the NuGet is only when you have to use .NET Core < 3.1 – Vinicius Jarina May 23 '20 at 19:13
  • 1
    1) Learn what Microsoft documentation really means, https://blog.lextudio.com/how-to-understand-net-api-browser-dec-2017-16fe068ab072 2) What you tried is completely wrong, as you need a package reference, not a normal reference. – Lex Li May 23 '20 at 19:37

1 Answers1

0

When trying to mess with imagery in .NET Core, i recommend using ImageSharp, which is a pretty easy to use cross-plattform imaging library available on NuGet. I figured out how it works pretty quickly and its documented really good.

VollRahm
  • 397
  • 1
  • 16