如何在.NET Core上直接调用F#编译器? [英] How to directly invoke F# compiler on .NET Core?

查看:92
本文介绍了如何在.NET Core上直接调用F#编译器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

UPD。

我想直接从.NET Core SDK调用F#编译器(即fsc)。

I want to invoke F# compiler (i.e. fsc) from .NET Core SDK directly.

我了解dotnet构建& co,但是当我只需要编译一个简单的问题时,即在fsc file.fs足够的情况下,我不想让他们参与。

I know about dotnet build & co, but I don't want to involve them when I only need to compile a simple problem, i.e. in cases when fsc file.fs would be enough.

ve尝试在.NET Core SDK中进行搜索(在我的Mac上,它位于/usr/local/share/dotnet/sdk/2.2.102/FSharp中),并在那里找到了fsc.exe文件。不幸的是,当我尝试使用dotnet /usr/local/share/dotnet/sdk/2.2.102/FSharp/fsc.exe启动它时,出现了一个错误:

I've tried to search in .NET Core SDK (on my Mac, it was in /usr/local/share/dotnet/sdk/2.2.102/FSharp) and found a fsc.exe file there. Unfortunately, when I try to start it with dotnet /usr/local/share/dotnet/sdk/2.2.102/FSharp/fsc.exe, it gives me an error:

error FS0193: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

环境:macOS,.NET Core 2.2

Env.: macOS, .NET Core 2.2

推荐答案

安装dotnet core( https://dotnet.microsoft。 com / download ),您应该可以从命令行构建F#项目。

After install dotnet core (https://dotnet.microsoft.com/download) you should be able to build a F# project from the command line.

cd my-fs-project
dotnet build
dotnet run

这篇关于如何在.NET Core上直接调用F#编译器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆