-
Notifications
You must be signed in to change notification settings - Fork 789
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dotnet fsi dependencymanager extensions doc (#10511)
Co-authored-by: Phillip Carter <[email protected]>
- Loading branch information
1 parent
aec399c
commit a54d33f
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |