3

VS2013专业版如何运行FParsec?

我尝试使用以下 nuget 包:

我尝试自己编译https://bitbucket.org/fparsec/main的源代码并使用生成的 dll:FParsec.dllFParsecCS.dll

但无论哪种方式,我总是在运行教程代码时遇到以下异常:

System.MissingMethodException
Method not found: 
  Microsoft.FSharp.Core.FSharpFunc`2<FParsec.CharStream`1<!!0>,FParsec.Reply`1<Double>> FParsec.CharParsers.pfloat()"

谁能提供让 FParsec 在 VS2013 上运行的分步解决方案?

这是我尝试运行的代码:

open FParsec

[<EntryPoint>]
let main args =
  let str s = pstring s // This line works
  let floatBetweenBrackets = str "[" >>. pfloat .>> str "]" // This line breaks
  Console.ReadKey() |> ignore
  0
4

1 回答 1

6

尝试使用以下内容将 App.config 添加到您的项目中:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.3.1.0" newVersion="4.3.1.0" />
      </dependentAssembly>
  </runtime>
</configuration>

检查您的 FSharp.Core 版本并在必要时修补此代码段。

于 2014-05-12T12:21:04.377 回答