F# 交互式在 PCLStorage 中抛出 NotImplementedException

标签 f# portable-class-library f#-interactive

我在尝试在 F# 交互中使用 PCLStorage.FileSystem.Current 时遇到 NotImplementedException。

我用 NuGet 下载了 PCLStorage,右键单击引用并单击“发送到 F# 交互式”

我正在使用 VS2015 更新 1,并且我已经按照建议重新安装了包 in this answer

如何让 PCLStorage 在 F# 交互中工作?

--> Referenced 'C:\Users\amade\Documents\GitHub\audioExperiments\src\Audio\packages\PCLStorage.1.0.2\lib\portable-net45+wp8+wpa81+win8+monoandroid+monotouch+Xamarin.iOS+Xamarin.Mac\PCLStorage.dll'

> open PCLStorage;;
> PCLStorage.FileSystem.Current;;
> System.NotImplementedException: This functionality is not implemented in the portable version of this assembly.  You should reference the PCLStorage NuGet package from your main application project in order to reference the platform-specific implementation.
   at PCLStorage.FileSystem.get_Current()
   at <StartupCode$FSI_0017>.$FSI_0017.main@()
Stopped due to error

最佳答案

您引用的 PCL 是为所有平台(Xamarin、Windows 桌面、Windows 手机等)设计的。此 dll 仅用作将所有单独方法定义为诱饵和开关 PCL 技术的一部分的手段 http://log.paulbetts.org/the-bait-and-switch-pcl-trick/如果您想将库与 FSI 一起使用,则需要添加对相应平台的 DLL 的特定引用。在这种情况下,您需要引用从 NuGet 下载的项目的 Windows 桌面版本。

关于F# 交互式在 PCLStorage 中抛出 NotImplementedException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34563252/

相关文章:

list - 空列表中的 F# 值限制

wpf - 如何将数据绑定(bind)到 XAML 中的联合案例值?

asp.net - 引用.net标准类库时未找到System.Runtime程序集

xamarin.ios - MonoDevelop Intellisense 不显示 PCL 中的所有项目

debugging - 如何诊断 F# 交互中的故障源

f# - 将 COM DLL 与 FSI 结合使用

f# - F# Interactive 中的 StructLayout 限制?

f# - fsx 脚本在异步响应返回之前完成

f# - 避免指示状态的可变 bool 值

c# - 在 Xamarin Forms PCL 中从 Javascript 调用 C# 函数