Search code examples
c#colorsbitmapsystem.drawingambiguous

Ambiguous reference between 'Microsoft.Xna.Framework.Color' & 'System.Drawing'


I think this is a simple question to answer, but I still can't figure out a way to get past it.

Basically, what I wanted, was to use a Bitmap object in my Xna game. So I went ahead and added System.Drawing as an assembly reference. This worked out perfectly, except that I now get a different error; "'Color' is an ambiguous reference between 'Microsoft.Xna.Framework.Color' and 'System.Drawing'. How do I get past this?


Solution

  • The assembly reference alone doesn't lead to the error. It's the using that you've probably inserted, because it imports the whole namespace. You could try

    using Bitmap = System.Drawing.Bitmap
    

    instead to import the bitmap only.