问题
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