Unquote: What am I missing?

社会主义新天地 提交于 2019-12-10 22:38:22

问题


I'm trying to get the Unquote library working with xUnit in .NET 4, and I'm not having any luck at all getting the tests to run. So, I broke it down to the simplest reproduction steps I could. Does anybody know what I might be missing?

  1. Create a new F# Library project.
  2. Use NuGet to add xUnit and Unquote references.
  3. Paste in the following code...

I got the actual test directly from the Unquote home page, but the content doesn't matter, because it doesn't get run.

module Tests

open Xunit
open Swensen.Unquote

[<Fact>]
let ``demo Unquote xUnit support`` () =
    test <@ ([3; 2; 1; 0] |> List.map ((+) 1)) = [1 + 3..1 + 0] @>

Then I compile the assembly and load it into the xUnit.net GUI test runner (64-bit, CLR 4) and get the following error when I run the test:

Tests.demo Unquote xUnit support : System.MissingMethodException : Method not found:
'Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Quotations.FSharpExpr> Swensen.Unquote.Extensions.Expr.ReduceFully(Microsoft.FSharp.Quotations.FSharpExpr)'.
Stack Trace:
   at Tests.demo Unquote xUnit support()

回答1:


Never mind, I figured it out. I'm using the VS 11 preview, and even though I'm targeting .NET 4.0 in my project, the project is referencing the wrong version of FSharp.Core.dll:

C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\3.0\Runtime\v4.0\FSharp.Core.dll

I changed it to reference this one instead, and everything started working properly:

C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\2.0\Runtime\v4.0\FSharp.Core.dll



来源:https://stackoverflow.com/questions/7828852/unquote-what-am-i-missing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!