0

I am creating an example for our next F# meetup and have run into an issue.

I have downloaded the FSharp.Data v2.2.1 to try the JSON tutorials to parse (stock options) data downloaded from the web. I have been struggling with this issue for almost a week now. I have followed the suggestions seen in other posts including complete uninstall of packages suggestion. I ran into the same issue trying to use the CSV provider and decided to switch to JSON.

I have #load @"C:\ full path to dll ...\lib\net40\FSharp.Data.dll" For some reason I have to give the full path for the F# script file to recognize it.

The line open FSharp.Data has an error "The namespace 'Data' is not defined" Nuget package manager shows that FSharp.Data version:2.2.1 is installed. I have uninstalled and reinstalled all packages in the project several times but it does not change the error.

So I am stuck at that point. I could use some insights from anyone who has been down this path.

PiotrWolkowski
8,8007 gold badges53 silver badges76 bronze badges
asked May 6, 2015 at 1:32
4
  • Does it work in F# Interactive? Also, when loading the library to F# Interactive try right clicking the library in the references folder (in Visual Studio project) and select the "Send to F# Interactive" option. Commented May 6, 2015 at 1:45
  • I am only using F# Interactive only for this example. I tried your suggestion to do a right click in the references and I get an error "file may be locked by F# Interactive process" Commented May 6, 2015 at 1:49
  • I've run into similar issue. Please check it, there are some suggestions in the comments: stackoverflow.com/q/27338504/3330348 Commented May 6, 2015 at 1:50
  • I used the last suggestion to add #r @"full pathname\FSharp.Data.dll" in addition to the #load @"full path name\FSharp.Data.dll" and it now recognizes the dll but when I try to use it to run a small example it has and error. "error FS0073: internal error: ParseInput: unknown file suffix for FSharp.Data.dll" Commented May 6, 2015 at 1:58

1 Answer 1

1

The following steps worked for me. I started from a new F# project and did everything in F# Interactive.

  1. Right click references folder in the project manager.
  2. Select manage nuget packages
  3. Install FSharp.Data
  4. Reference the library in F# Interactive:

    \#r @"C:\Users\{Full project path}\packages\FSharp.Data.2.2.1\lib\net40\FSharp.Data.DesignTime.dll";;
    

    I get the warning that the library is locked. But F# Interactive allows me to open it.

  5. Open the library:

    open FSharp.Data;;
    
  6. Run JsonProvider on file with data:

    type Stocks = JsonProvider<"C:\msft.txt">;;
    
answered May 6, 2015 at 3:02
1
  • I followed your suggestions to the letter and created a fresh project. I did not use the #load like I did before but instead used right click on references to send FSharp.Data to F#Interactive. I did the full #r #"fullpathname\FSharp.Data.dll" and now it can find the JsonProvider. I can now proceed with solving the other issues. Thank you! Commented May 6, 2015 at 11:51

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.