2016-01-02 120 views
3

我得到NotImplementedException尝试在F#交互中使用PCLStorage.FileSystem.CurrentF#交互式抛出PCLStorage中的NotImplementedException

我下载PCLStorage用的NuGet,右击的参考,并点击“发送到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>[email protected]() 
Stopped due to error 
+2

鉴于您的F#交互式运行在完整版本的.NET中,您需要编译一个与之匹配的库。 –

回答

2

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

+0

谢谢,这很有道理! '#r'指令是将Windows DLL加载到交互式窗口的正确方法吗? –