Martimatix
Martimatix

Reputation: 1643

Can you run an F# script file (.fsx) using .net core?

Is it possible to run .fsx files using .net core? (Equivalent to fsharpi on Mono.)

Upvotes: 22

Views: 5284

Answers (3)

knocte
knocte

Reputation: 17929

It works out of the box in .NETCore v3.0 or newer:

$ cat hello.fsx
#!/usr/bin/env fsharpi
printfn "hello world"
$ dotnet fsi hello.fsx
hello world
$ dotnet --version
3.0.100

PS: Side-note: if you want to compile your scripts without having to run them, check this tool.

Upvotes: 15

jpierson
jpierson

Reputation: 17354

I went looking for this answer and the best I could find matches your comment @Martimatix from March 28 however I did find issue 2407 in the visualfsharp repo which tracks the support for fsi on .NET Core 2.0.

Update (April 2009): It looks like there is now a preview version now for .NET Core available. https://devblogs.microsoft.com/dotnet/announcing-net-core-3-preview-3/

Upvotes: 6

Tobia
Tobia

Reputation: 18811

They are working on it. This is the main issue, the same one posted by jpierson.

You can try right now with something like this:

dotnet /usr/share/dotnet/sdk/2.1.403/FSharp/fsi.exe test.fsx

It kinda / sorta works, but there are parts missing, especially full support for #r and interactive line editing (readline).

Upvotes: 4

Related Questions