I'm in the process of converting an Asp.Net Core 2.2 Website that targeted the Full Framework to an Asp.Net Core 3.1 App that targets .Net Core 3.1. I'm a bit unclear about dependencies related to System.Drawing and how to fulfill them.
My project uses System.Drawing and when compiling under Asp.Net Core 3.1 I get this error that suggests that I add a reference to System.Drawing.Common.dll
:
Error CS1069: The type name 'Image' 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. 1-wwwGiftOasis3 C:\Users\Ron\source\repos\wwwGiftOasis3\wwwGiftOasis3\site\seller\profile\about\s-photos.cs
In Visual Studio I don't see a way to add a reference directly to the bare System.Drawing.Common.dll
so I assume that I should add the reference via NuGet.
In NuGet I see a System.Drawing.Common
package which looks like what I want but it's unclear to me whether my project fulfills the dependencies:
My Project shows these dependencies:
So I have a couple questions related to all this:
1) Does the fact my the project depends on Framework Microsoft.NETCore.App
fulfill the NuGet package's Microsoft.NETCore.Platforms
dependency?
2) Does the fact that I intend to only run this Asp.Net Core 3.1 website on windows fulfill the NuGet package's Microsoft.Win32.SystemEvents
dependency?
Drawing. Common is used cross-platform mostly for image manipulation, such as QR code generators and text rendering. We haven't noticed heavy graphics usage, as our cross-platform graphics support is incomplete. The usages we see of System.
In electric wiring, a system using conductors installed in conduits, ducts, racweays, and boxes, thereby permitting removal and replacement of any conductor without disturbing any part of the building structure or finish.
The System.Drawing Namespace This namespace contains the Graphics class, which provides methods for filling and drawing graphics objects.
System.Drawing
utilizes Windows-specific APIs, and as such, is incompatible with .NET Core, which is cross-platform. Microsoft created System.Drawing.Common
as an in-place replacement for System.Drawing
for .NET Core. It is an exact API replacement, but performs the image operations in a cross-platform, rather than Windows-specific, way.
Long and short, yes, you just drop the NuGet into your project and go to town. There's nothing else you need to worry about.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With