我需要在运行时将一些f#源文件编译成一个程序集。
目前我正在使用Fsharp.Compiler.CodeDom,它可以完成我的需求,但似乎这个库已经没有维护了。
我想知道,我是否使用了正确的库?
注意:我看到了一些类似问题的答案,但那些问题是几年前的。
[<EntryPoint>]
let main argv =
printfn "%A" argv
let scs = SimpleSourceCodeServices();
let fn = Path.GetTempFileName();
let fn2 = Path.ChangeExtension(fn, ".fs");
let fn3 = Path.ChangeExtension(fn, ".dll");
File.WriteAllText(fn2, """
module File1
let seven =
3 + 4
""");
let errors1, exitCode1 = scs.Compile([| "fsc.exe"; "-o"; fn3; "-a"; fn2 |])
let ex = File.Exists(fn3)
printfn "File %s exists: %b" fn3 ex
我必须承认,看到一个非 fsc.exe 选项会很酷 :D