linux - How to compile c sharp console application in linux with multiple modules (how to define order of fs files?)

标签 linux f#

如何从控制台使用 fsharpc 在 Linux 中编译 fsharp 应用程序?

我有多个模块,应用程序的入口点位于 Program.fs 文件中,采用经典的控制台应用程序样式:

open module A
open module B
open module C

[<EntryPoint>]
    let main argv = 
    ...

其中 A、B、C 位于名为 A.fs、B.fs 和 C.fs 的文件中...

在 Visual Studio 中,可以通过在项目 View 中重新排列文件来轻松定义编译文件的顺序,但是我不清楚如何在 linux 中执行此操作...?

我想我必须以某种方式在控制台中定义顺序

$ fsharpc -o test.exe Program.fs --fileorder:[A.fs,B.fs,C.fs,Program.fs]

我正在使用 F# 3.1 (目前正在使用新的跨平台 VSCode IDE)

最佳答案

只需按正确的顺序将文件传递给 fsharpc:

$ fsharpc --out:test.exe A.fs B.fs C.fs Program.fs

我通常将这个列表存储在一个文件中,然后使用 xargs:

$ cat dependency-order.txt
A.fs
B.fs
C.fs
Program.fs
$ cat dependency-order.txt | xargs -d '\n' fsharpc --out:test.exe

关于linux - How to compile c sharp console application in linux with multiple modules (how to define order of fs files?),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30006359/

相关文章:

.net - 模式匹配记录类型

java - Linux 播放视频命令在几秒钟后卡住

linux - 如何知道linux系统调用的编号

linux - 尝试在 Windows 上使用 bash 并没有收到已安装的发行版消息

c# - 在 C# 中使用 F# 数据类型

F#、命名空间、模块、fs 和 fsx

c++ - 确定 QKeyEvent 的来源

linux - iptable 用于端口转发

F# 模式匹配中的惯用转换?

razor - ServiceStack.Razor + F#