F# Interactive CsvProvider not defined

允我心安 提交于 2019-12-24 00:34:19

问题


I'm loading FSharp.Data in the interactive console. The library is loaded without any problem:

> #r "FSharp.Data.dll";;

--> Referenced 'C:\Users\pw\AppData\Local\Temp\FSharp.Data.dll' (file may be locked by F# Interactive process)

> open FSharp.Data;;

However, when I'm trying to initialize CsvProvider (defined in FSharp.Data) I get the error message saying the type is not defined:

> type Stocks = CsvProvider<"C:\Users\pw\Downloads\msft.csv">;;

type Stocks = CsvProvider<"C:\Users\pw\Downloads\msft.csv">;;
--------------^^^^^^^^^^^

stdin(62,15): error FS0039: The type 'CsvProvider' is not defined

I thought the problem may be with file and assemblies paths but now I'm using absolute paths and the error remains. On the other hand, I am able to use the CsvProvider when I'm creating a standard, not interactive, project. Any help to make it work in interactive session highly appreciated.


回答1:


The warning about file being locked looks worrisome. Can you copy FSharp.Data somewhere and reference it using absolute path:

\#r @"C:\Poligon\packages\FSharp.Data.2.1.0\lib\net40\FSharp.Data.dll";;


来源:https://stackoverflow.com/questions/27338504/f-interactive-csvprovider-not-defined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!