问题
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?
- Create a new F# Library project.
- Use NuGet to add xUnit and Unquote references.
- 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