取消引用:我错过了什么?
我正在尝试让 Unquote 库与 .NET 4 中的 xUnit 一起使用,并且我'我根本没有运气让测试运行。因此,我将其分解为最简单的重现步骤。有人知道我可能会错过什么吗?
- 创建一个新的 F# 库项目。
- 使用 NuGet 添加 xUnit 和 Unquote 引用。
- 粘贴以下代码...
我直接从 Unquote 主页获得了实际测试,但内容并不重要,因为它没有运行。
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] @>
然后,我编译该程序集并将其加载到 xUnit.net GUI 测试运行程序(64 位,CLR 4)中,并在运行测试时收到以下错误:
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()
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()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没关系,我已经弄清楚了。我正在使用 VS 11 预览版,尽管我在项目中以 .NET 4.0 为目标,但该项目引用了错误版本的 FSharp.Core.dll:
C:\Program Files (x86)\Reference Assemblies\Microsoft \FSharp\3.0\Runtime\v4.0\FSharp.Core.dll
我将其更改为引用这个,一切都开始正常工作:
C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\2.0\Runtime\v4.0\FSharp.Core.dll
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