F# .fsx script: how to register 'paket' as package manager?

Viewed 713

any help appreciated!

Objective & Problem

  • Objective: Use F# as scripting language on Linux, while resolving and installing automatically the package dependencies
  • Problem: The #r loading of Nuget package assemblies via Paket doesn't work

In that simplified example, I will use Fake to run a system command:

#r "paket:
nuget Fake.Core"

open Fake.Core

printfn "Test OK"

When I run the script, I got the following error:

$ dotnet fsi test.fsx

/home/mat/fsx-test/test.fsx(1,1): error FS3216: Package manager key 'paket' was not registered in [/usr/share/dotnet/sdk/3.1.403/FSharp; /usr/share/dotnet/sdk/3.1.403/FSharp/], []. Currently registered: nuget

/home/mat/fsx-test/test.fsx(1,1): error FS3217: Processing of a script fragment has stopped because an exception has been raised

System Information

$ which paket
/home/mat/.dotnet/tools/paket
$ dotnet --info
mat0cebcbce666:~/fsx-test# dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.403
 Commit:    9e895200cd

Runtime Environment:
 OS Name:     debian
 OS Version:  10
 OS Platform: Linux
 RID:         debian.10-arm
 Base Path:   /usr/share/dotnet/sdk/3.1.403/

Host (useful for support):
  Version: 3.1.9
  Commit:  774fc3d6a9

.NET Core SDKs installed:
  3.1.403 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.9 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.9 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
1 Answers
Related