leo.luo
leo.luo

Reputation: 1

Can not use System.drawing.common in Mono.Android and Xamarin.ios

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?

Upvotes: 1

Views: 2037

Answers (2)

Lars V
Lars V

Reputation: 36

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.

Upvotes: 0

Billy Liu
Billy Liu

Reputation: 2168

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.

Upvotes: 1

Related Questions