Search code examples
.netmacossystem.drawing

How to use System.Drawing on Mac OS?


  1. Run NuGet Package manager
  2. Add "System.Drawing.Common"
  3. Add using System.Drawing I still cannot use Point or Image in my code.

.csproj file does have

<PackageReference Include="System.Drawing.Common" Version="4.7.0"/>

Solution

  • I was able to get System.Drawing.Common working in OSX by also adding the runtime.osx.10.10-x64.CoreCompat.System.Drawing NuGet package.

    Note that my OSX test platform is Azure Pipelines. You can look over my csproj file if you find it helpful. It contains:

    <ItemGroup>
      <PackageReference Include="runtime.osx.10.10-x64.CoreCompat.System.Drawing" Version="5.8.64" />
      <PackageReference Include="System.Drawing.Common" Version="4.7.0" />
    </ItemGroup>
    

    Don't forget to add a using statement to the top of your CS files:

    using System.Drawing;