我在尝试在 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/