我正在经历这个tutorial但没有 fsc(F Sharp 编译器)。运行
dotnet fsc -a MyAssembly.fs
显示:
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* You intended to execute a .NET Core program, but dotnet-fsc does not exist.
* You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
运行 ls/usr/local/share/dotnet/sdk/3.0.100/FSharp
显示:
FSharp.Build.dll fsc.exe
FSharp.Compiler.Interactive.Settings.dll fsc.runtimeconfig.json
FSharp.Compiler.Private.dll fsi.deps.json
FSharp.Core.dll fsi.exe
Microsoft.FSharp.NetSdk.props fsi.runtimeconfig.json
Microsoft.FSharp.NetSdk.targets it
Microsoft.FSharp.Overrides.NetSdk.targets ja
Microsoft.FSharp.Targets ko
Microsoft.Portable.FSharp.Targets pl
cs pt-BR
de ru
default.win32manifest tr
es zh-Hans
fr zh-Hant
fsc.deps.json
其中有 fsi.exe
和 fsc.exe
。我相信这意味着 dotnet fsc
将会存在。
此外,我从这个 guide 得到了单声道所以 fsharpc
和 fsharpi
工作。
最佳答案
指南有点老了。这Stack Overflow question讨论我们通常不直接使用fsc.exe
而是创建一个项目并使用 .NET Core CLI ( dotnet
) 来构建和运行 F# 项目。 using the .NET Core SDK 有入门指南这应该可以帮助你。
关于dotnet fsc
的使用有一个discussion thread关于它在 GitHub 上。据我所知fsc
关键字是 - 与所讨论的事情相反 - 未实现。 fsi
关键字是,虽然。您仍然可以使用 fsc.exe
直接地。只需调用 dotnet <full-path-to-fsharp-sdk-location>/fsc.exe
.如上所述 - 通常不需要调用 fsc
除了非常特殊的任务或诚实的好奇心之外。
关于.net - 在 Mac 上从命令行运行 Dotnet F Sharp 编译器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59814243/