问题
I am using System.drawing.common in my project, and it worked fine in .net core.
Now I am trying to use System.drawing.common in Mono.Android project and Xamarin.ios project. Some problem occured:
1, I create a Mono.Android lib project, and install System.drawing.common with NuGet. It seems to be successful, but after installing, I can not find System.drawing.common in the "reference" list. I tryed to use "System.Drawing.Bitmap", but can not find Bitmap class.
2, I checked the package folder, such as "\packages\System.Drawing.Common.4.5.0-preview2-26406-04\lib". In the "netstandard2.0" folder, there is a DLL. In "MonoAndroid10" folder, there is a 0KB file named ".".
So, how can I use System.drawing.common in Mono.Android and Xamarin.ios?
回答1:
According to this Issue, it seems you need to get copy System.Drawing.Common.dll manually to the output folder. Or you could try to update your VS.
回答2:
As I understand it, Xamarin/Android is not supported yet. I went through the process of porting my rendering code to netstandard 2.0, using System.Drawing.Common, and manually copied the dll to my app folder. Finally the exception I got from System.Drawing.Common was "PlatformNotSupported".
From discussions over at the netstandard/netcore dev forums it seems that a fix is scheduled for netstandard 3.0.
来源:https://stackoverflow.com/questions/49915844/can-not-use-system-drawing-common-in-mono-android-and-xamarin-ios