System.Drawing.Color in C# Component (Rhino 8 WIP Mac)

Hi,

Working on C# codes in Rhino 8 WIP Mac, and I’ve got those errors. The same code works in Rhino 7.

  1. Error (CS0012): The type ‘Color’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘System.Drawing.Primitives, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’. (line 314)
  2. Error (CS1069): The type name ‘Color’ could not be found in the namespace ‘System.Drawing’. This type has been forwarded to assembly ‘System.Drawing.Primitives, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ Consider adding a reference to that assembly. (line 314)

have you tried to reference the assembly first like is stated in the examples? for example in your case:

// r "System.Drawing"

I am using C# scripting component, not RhinoCode in Grasshopper. I tried it anyway but it doesn’t work…

Since Rhino 8 WIP on Mac runs on .NET 6 you are probably better off not using System.Drawing: Breaking change: System.Drawing.Common only supported on Windows - .NET | Microsoft Docs

I suggest you use Color Structure , especially since Rhino uses Eto.Forms and Eto.Drawing for much of its interface.

1 Like

That’s good to know. Thanks much.

W