MSB3245:Could 无法解析此引用 (System.Drawing.Imaging)

MSB3245:Could not resolve this reference (System.Drawing.Imaging)

我正在 Visual Studio 代码中开发 F#,当我尝试使用 FAKE 编译我的代码时,出现了上述错误:

warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Drawing.Imaging". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

然后是一长串 "Considered <various filepaths>, but it didn't exist." 包括我的 .NET Framework 文件夹和 GAC,这很奇怪。老实说,我希望 Imaging 是在 System.Drawing.dll 中声明的命名空间,但编译器似乎甚至没有考虑这个选项...

我在 System.Windows.MediaSystem.Windows.Media.ImagingSystem.Windows.Media.IO 中遇到了相同的错误。可能相关的事实是 IntelliSense 也没有选择这些命名空间,尽管它 确实 找到 System.Drawing.Imaging...

碰巧,我在写它的时候发现了我的问题,但我想我也可以post它以防其他人有同样的问题。

根本问题是 >F#: Add Reference 不工作,我的意思是如果我点击 >F#: Add Reference > <current project> > System.Drawing.Imaging(比方说),什么都没有特别的事情似乎发生了。如果有人能解决这个问题并且 post 是他们的答案,我会接受他们的答案并点赞,因为这才是真正的问题。

为了解决 VSCode 中的错误,我手动编辑了我的 fsproj 文件,但似乎我并没有真正理解我在做什么。显然,当以我使用的格式给出 <Reference>s 时,它会寻找显式 dll,当然 .Imaging 等格式不存在。一旦我删除了这些错误就消失了,没有像我预期的那样产生新的错误,比如没有识别 Bitmap

更新:现在也发现了 Add Reference 的问题:当用户名中有空格时,显然 Ionide 不会生成正确的 Forge 命令,例如 Windows.