我有一個C#程序調用這個F#代碼snipet。在執行let fsiSession
時,我得到下面的例外。這些site暗示了一些想法,但我不明白他們在說什麼。我不知道在哪裏找到了FSharp.Core.optdata。FSharp.Core.optdata沒有在FSharp上找到.Core
namespace FsharpTestgSystem
open System
open System.IO
open System.Text
open System.CodeDom
open Microsoft.FSharp.Compiler.SourceCodeServices
open Microsoft.FSharp.Compiler.Interactive.Shell
open Microsoft.FSharp.Compiler.SimpleSourceCodeServices
type TestSystem() =
// Intialize output and input streams
// Build command line arguments & start FSI session
let argv = [| "C:\\Program Files (x86)\\Microsoft SDKs\\F#\\4.1\\Framework\\v4.0\\fsi.exe" |]
let allArgs = Array.append argv [|"--noninteractive"|]
let sbOut = new StringBuilder()
let sbErr = new StringBuilder()
let inStream = new StringReader("")
let outStream = new StringWriter(sbOut)
let errStream = new StringWriter(sbErr)
let fsiConfig = FsiEvaluationSession.GetDefaultConfiguration()
let fsiSession = FsiEvaluationSession.Create(fsiConfig, allArgs, inStream, outStream, errStream)
unknown(1,1): error FS1225: File '\bin\x64\Debug\FSharp.Core.optdata' not found alongside FSharp.Core
unknown(1,1): error FS0229: Error opening binary ...
這是說它應該在SDK目錄中。 [SO鏈接](http://stackoverflow.com/questions/21224314/what-are-fs-fsharp-core-optdata-and-fsharp-core-sigdata-files/)順便說一句,我能找到的唯一地方這個文件在Fake/tools中。 – s952163