我安装了F#2.0.0,并使用mono 2.8 .
let rec fib n =
match n with
| 1 | 2 -> 1
| n -> fib(n-1) + fib(n-2)
let n = 40
let x = fib(n)
printfn "%d" x
我用fsc.exe编译了这段代码来获取fib.exe . 用mono fib.exe运行这个给我这个错误 .
mono fact.exe
Could not load file or assembly 'FSharp.Core, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
Unhandled Exception: System.TypeLoadException: Could not load type
'.$Factorial' from assembly 'factorial, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null'.
可能有什么问题?
已添加
sudo gacutil -i FSharp.Core.dll
解决了这个问题 .
1 回答
F#程序集(如FSharp.Core.dll)可能只安装到.Net GAC . 您需要将它们安装到Mono的GAC(Mono的gacutil.exe),或将程序集复制到与可执行文件相同的目录中 .