ContentImporter - Could not load type 'System.Drawing.Bitmap' from assembly 'System.Drawing.Common'

I’m having a problem with my ContentImporter since upgrading to MonoGame 3.8 in a Windows environment. It’s a content importer that loads a bitmap (png) file and upscales it 4 times its normal size (useful for creating pixel graphics).

When I try and build content with this ContentImporter, I was first getting the error that System.Drawing.Common was missing. Once I resolved that by adding a reference to that DLL in MGCB Editor, I started getting “Could not load type ‘System.Drawing.Bitmap’ from assembly ‘System.Drawing.Common’”.

It doesn’t give me a specific error line from my code but the line in my code that creates a Bitmap which is used throughout my code looks like so:

Bitmap bitmap = Bitmap.FromFile(filename) as Bitmap;

My project is a Dot Net 3.1 project and I’m referencing the latest stable version of System.Drawing.Common (6.0.0).

This was working prior to upgrading to 3.8… I believe I was on 3.6 at the time.

I setup a console app to test running this and it works fine. It seems to only fail when its being run from the content importer ran by MonoGame / content importer editor.

Do I need a specific older version of System.Drawing.Common or anything else to check?

I switched the DLL reference the DLL in the bin directory of my console project which has all the DLLs I need and that gets me past this error but then now gives me the error:

System.Drawing.Common is not supported on this platform.

I guess my option at this point is to rewrite this using something else because I just can’t run int out of the MGCB Editor / pipeline???

Daft Q, but is that assembly supported in .Net Core?

I spent a bit of time rewriting it using ImageSharp this morning. Works good now, wasn’t too bad to change things over.

1 Like

Cool, I was about to blame bees for your issue…

1 Like