Skip to content

Commit

Permalink
Dotnet fsi dependencymanager extensions doc (#10511)
Browse files Browse the repository at this point in the history
Co-authored-by: Phillip Carter <[email protected]>
  • Loading branch information
smoothdeveloper and cartermp authored Nov 22, 2020
1 parent aec399c commit a54d33f
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/fsharp/FSharp.DependencyManager.Nuget/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# `dotnet fsi`: NuGet Dependency Manager Plugin

This extension ships by default since .NET 5. It can be used in F# interactive through `dotnet fsi` without further setup through `#r "nuget:"` references.

```fsharp
#r "nuget: Newtonsoft.Json"
// Optionally, specify a version explicitly
// #r "nuget: Newtonsoft.Json,11.0.1"
open Newtonsoft.Json
let o = {| X = 2; Y = "Hello" |}
printfn "%s" (JsonConvert.SerializeObject o)"
```

There are more Dependency Manager extensions, find more about them: [Microsoft.DotNet.DependencyManager](https://github.com/dotnet/fsharp/tree/main/src/fsharp/Microsoft.DotNet.DependencyManager)
44 changes: 44 additions & 0 deletions src/fsharp/Microsoft.DotNet.DependencyManager/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# `dotnet fsi` Dependency Manager Plugins

Since .NET 5.0, `dotnet fsi` ships with dependency manager plugins support that can be called like so:

```fsharp
#r "myextension: my extension parameters"
```

# `#r "nuget:"` [nuget](https://github.com/dotnet/fsharp/tree/main/src/fsharp/FSharp.DependencyManager.Nuget)

Reference nuget packages, ships by default with `dotnet fsi`.

```fsharp
#r "nuget: Newtonsoft.Json"
// Optionally, specify a version explicitly
// #r "nuget: Newtonsoft.Json,11.0.1"
open Newtonsoft.Json
let o = {| X = 2; Y = "Hello" |}
printfn "%s" (JsonConvert.SerializeObject o)
```

# `#r "paket:"` [paket](https://fsprojects.github.io/Paket/fsi-integration.html)

Reference dependencies (nuget, git, gist, github) through [Paket package manager](https://fsprojects.github.io/Paket).

Learn how to use [Paket FSI integration](https://fsprojects.github.io/Paket/fsi-integration.html).

```fsharp
#r "paket: nuget FSharp.Data"
open FSharp.Data
type MyCsv = CsvProvider<"""
X,Y
2,Hello
4,World
""">
for r in MyCsv.GetSample().Rows do
printfn "%i = %s" r.X r.Y
```

0 comments on commit a54d33f

Please sign in to comment.