I have been learning F# recently, and one of the great things about it is the REPL, called F# Interactive.
I ran into a problem when I tried to reference the
NuGet package in an
.fsx file, like so:
Those lines give no indication of any potential problems, but when I try to use
JsonConvert.DeserializeObject to deserialize a
JSON string, I get an ugly red squiggly with the following error message:
The type ‘Object’ is required here and is unavailable. You must add a reference to assembly ’netstandard, Version=220.127.116.11, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’.
Oh my. What to do?
I poked around a little bit on Google and Stack Overflow, but didn’t really find an easy fix, so I set out to find
netstandard.dll on my local machine. After a few false starts, I just did an Explorer search in
netstandard.dll and picked the most promising result.
I shift-right-clicked on the file to get the path and added it to my references in the
And voilà! The ugly red squiggly disappeared, and my script ran correctly in
If you know of a more elegant solution, please contact me on Twitter (@jonsagara) and I’ll update this post.
I’ve heard rumors that the F# team will make it easier to reference NuGet packages in future versions of
FSI. I can’t wait!