Logo Paket

F# Interactive Integration

F# Interactive v5 and above ships with extensions mechanism.

FSharp.DependencyManager.Paket implements this extension mechanism to hook same power as paket.dependencies file right inside .fsx scripts.

Making sure Paket is found

The extension runs the Paket .NET tool. It looks for, in order:

Install the extension

You have two choices to deploy the assembly:

Copying the assembly next to the host process

Install the FSharp.DependencyManager.Paket.dll aside of your F# Interactive binaries or the binary of the host process loading the extensions.

In general, the process will explicitly list the folders it is currently checking for extensions:

error FS3216: Package manager key 'paket' was not registered in [C:\Program Files\dotnet\sdk\5.0.100\FSharp; C:\Program Files\dotnet\sdk\5.0.100\FSharp\], []. Currently registered: nuget

The locations to copy FSharp.DependencyManager.Paket.dll

Dotnet SDK: - Windows
C:\Program Files\dotnet\sdk\<version number>\FSharp - macOS
/usr/local/share/dotnet/sdk/<version number>/FSharp - Linux
/home/user/dotnet/sdk/<version number>/FSharp

Visual Studio: - For Editor Support
C:\Program Files\Microsoft Visual Studio\<version number>\Community\Common7\IDE\CommonExtensions\Microsoft\FSharp - For Fsi Window Support
C:\Program Files\Microsoft Visual Studio\<version number>\Community\Common7\IDE\CommonExtensions\Microsoft\FSharp\Tools

Passing the folder of the extension as --compilertool flag

Use the --compilertool flag when invoking F# Interactive or refer to the documentation of the host process.

For example on windows:

--compilertool:"c:\users\username\.nuget\packages\fsharp.dependencymanager.paket\6.0.0-alpha055\lib\netstandard2.0"

For example on unix:

--compilertool:"~/.nuget/packages/fsharp.dependencymanager.paket/6.0.0-alpha055/lib/netstandard2.0"

Usage in scripts

Using it involves the #r directive with paket extension.

Here is an example importing FSharp.Data library:

#r "paket: nuget FSharp.Data"

open FSharp.Data
// do cool stuff

It is also possible to use github dependencies to import individual files:

#r "paket: github fsharp/FAKE src/legacy/FakeLib/Globbing/Globbing.fs"
#load @"fsharp\FAKE\src\legacy\FakeLib\Globbing\Globbing.fs"
 
let f = Fake.Globbing.search

Usage in FSharp.Compiler.Service

Same remarks as for installation section above, you'd either make sure the assembly is deployed aside the host process binary, or you'd pass --compilertool flag when building the project options (through GetProjectOptionsFromScript).

Multiple items
namespace FSharp

--------------------
namespace Microsoft.FSharp
namespace Microsoft.FSharp.Data

Type something to start searching.