如何在Mac OS上使用System.Drawing?

问题描述 投票:0回答:1
  1. 运行NuGet程序包管理器
  2. 添加“ System.Drawing.Common”
  3. 添加using System.Drawing我仍然无法在代码中使用Point或Image。

。csproj文件确实具有

<PackageReference Include="System.Drawing.Common" Version="4.7.0"/>
.net macos system.drawing
1个回答
0
投票

通过添加System.Drawing.Common NuGet包,我也可以使runtime.osx.10.10-x64.CoreCompat.System.Drawing在OSX中工作。

请注意,我的OSX测试平台是Azure Pipelines。如果发现有帮助,可以查看my csproj file。它包含:

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

不要忘记在CS文件顶部添加using语句:

using System.Drawing;
© www.soinside.com 2019 - 2024. All rights reserved.