System.Drawing.Bitmap Visual Studio 2017 年未被识别

System.Drawing.Bitmap not recognised in Visual Studio 2017

我正在 F# 中编写一个项目,该项目使用 System.Drawing、NET Standard 2.0 的位图功能,但无法构建该项目,因为 类型'Bitmap'未在'System.Drawing'中定义。

我尝试在不同位置添加对 System.Drawing 的引用,并确保我使用的是 NET Standard 库版本。另外,我已经修复并重新安装了 Visual Studio,但也没有任何运气。

当右键单击项目并单击 'Add Reference' 时,我遇到了以下消息。这可能与我的问题有关吗?

编辑:作为一个小情节 twist/contradiction,我可以在 System.Drawing 的 F# interactive 中执行代码。位图被完全接受并且编译没有任何问题。错误可能出在哪里?

大多数 System.Drawing 功能在 .Net Core 中不可用。 (对本机 Windows 库的依赖太多)您可以切换到 .net 框架或包含第三方包,如 https://github.com/CoreCompat/System.Drawing

它在这个 Nuget 包中可用(虽然在预览版中,仍然可以正常工作) https://www.nuget.org/packages/System.Drawing.Common/