parsing - 如何在 VS2013 中运行 FParsec

标签 parsing exception f# visual-studio-2013 fparsec

如何在 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

最佳答案

尝试将 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 版本并在必要时修补此代码段。

关于parsing - 如何在 VS2013 中运行 FParsec,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23608713/

相关文章:

ruby-on-rails - Hpricot 元素交集

parsing - Docker Swarm Inspect 从每个节点获取内部 IP

windows - 批处理 - If 语句导致错误

java - 使用多个 catch block 进行异常处理

php - 未捕获的 CurlException : 35: Unknown SSL protocol error in connection to graph. facebook.com:443

F# 方法指针 "not accessible from this code location"

F# Canopy - 生成随机字母和/或数字并在变量中使用

java - 用java解析XML文件

c# - 有没有办法可以使用 VS2012 将堆栈跟踪发送到 C# 控制台

f# - 我如何根据 list 做汽车和干部?