你能 运行 使用 .net 核心的 F# 脚本文件 (.fsx) 吗?

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

是否可以运行 .fsx 文件使用 .net 核心? (相当于 Mono 上的 fsharpi。)

我一直在寻找这个答案,我能找到的最好的答案与你在 3 月 28 日发表的@Martimatix 的评论相匹配,但是我确实在跟踪 support for fsi on .NET Core 2.0.

的 visualfsharp 存储库中找到了问题 2407

更新(2009 年 4 月): 看起来现在有一个适用于 .NET Core 的预览版。 https://devblogs.microsoft.com/dotnet/announcing-net-core-3-preview-3/

他们正在努力。 This is the main issue,jpierson.

发布的相同

您现在可以试试这样的东西:

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

它有点/有点工作,但缺少部分,特别是对 #r 和交互式行编辑 (readline) 的完全支持。

它在 .NETCore v3.0 或更新版本中开箱即用:

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

PS:旁注:如果您想编译脚本而不必 运行 它们,请选中 this tool(目前仅兼容 Linux/Mac 抱歉,我们接受 PR 以添加 Windows 支持)。