.net - 在 Mac 上从命令行运行 Dotnet F Sharp 编译器

标签 .net macos f#

我正在经历这个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.exefsc.exe。我相信这意味着 dotnet fsc 将会存在。

此外,我从这个 guide 得到了单声道所以 fsharpcfsharpi 工作。

最佳答案

指南有点老了。这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/

相关文章:

.net - .NET 框架中程序集和命名空间之间的关系?

c# - 使用 C# 求解偏微分方程

c# - 如何在 .NET 中确定我的显示器的真实像素大小?

cocoa - 扩展 iPhoto 以将图片发布到不同的 Web 服务吗?

linux - 在 Mac OS X 中清理信号量

c++ - 获取dylib模块的SizeOfImage和EntryPoint

f# - 为什么 Seq.groupBy 不能像我认为的那样与列表一起工作? (F#)

macos - 在 Mac 上编译单个 F# 程序

C# - IoC - WebAPI 2 上的 Autofac 依赖注入(inject)

macos - Mac 上的 F# Interactive 在哪里