且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

您可以使用 .net 内核运行 F# 脚本文件 (.fsx) 吗?

更新时间:2022-12-06 17:49:15

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

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:旁注:如果你想编译你的脚本而不必运行它们,检查 这个工具(抱歉,目前仅兼容 Linux/Mac,我们接受 PR 以添加 Windows 支持).

PS: Side-note: if you want to compile your scripts without having to run them, check this tool (only Linux/Mac compatible for now sorry, we accept PRs to add Windows support).