简体   繁体   中英

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"/>

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM