Skip to content

usepackagetargets updates to #r nuget syntax #45467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/fsharp/tools/fsharp-interactive/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,16 @@ let f (x: Tensor) = sin (sqrt x)
printfn $"{f (dsharp.tensor 1.2)}"
```

By default, ````#r "nuget: ...."```` doesn't use build targets from the package being referenced during restore. The `usepackagetargets` option enables the use of these build targets when required. Only add `usepackagetargets=true` if the referenced package was authored to require it during restore.
Examples:

```fsharp
// load fsharp.data nugetpackage and consume buildtargets from fsharp.data package during restore.
#r "nuget:fsharp.data,usepackagetargets=true"
#r "nuget:fsharp.data,6.6.0,usepackagetargets=false"
#r "nuget:fsharp.data,6.6.0,usepackagetargets=true"
```

### Specifying a package source

You can also specify a package source with the `#i` command. The following example specifies a remote and a local source:
Expand Down