You can load packages into a .NET notebook from NuGet using the following syntax:
#r "nuget:<package name>[,<version=package version>]"
You can specify alternative sources using #i
:
#i "nuget:<nuget-source>"
If you don't provide an explicit package version, the latest available non-preview version will be loaded.
Here's an example:
#r "nuget:FSharp.Data"
Now that the package is loaded, we can add some using
statements and write some code.
open FSharp.Data
[<Literal>]
let url = "https://en.wikipedia.org/wiki/2017_Formula_One_World_Championship"
type F1_2017 = HtmlProvider<url>
let f1Calendar = F1_2017.Load(url).Tables.``Season calendar``
f1Calendar.Rows
|> Seq.map (fun x -> x.Circuit, x.Date)
If you want to load an assembly that's already on disk, you can do so using this syntax:
#r "<path to .dll>"
You can load an F# script (typically a .fsx
file) into the notebook using this syntax:
#load "<path to .fsx file>"
// Example:
#load "some-fsharp-script-file.fsx"