.net-coref#mono

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.)


Solution

  • 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.