【发布时间】:2014-01-29 20:49:49
【问题描述】:
我正在尝试为 C# 测试实现 xUnit,但遇到了一个奇怪的错误。
我可以在 VisualStudio (2013) 中运行单元测试,但是当我尝试使用 GUI 或控制台运行相同的测试时出现错误:
xUnit.net console test runner (32-bit .NET 2.0.50727.5472)
Copyright (C) 2013 Outercurve Foundation.
Could not load file or assembly '[...]' or one of its dependencies.
This assembly is built by a runtime newer than the currently loaded
runtime and cannot be loaded.
我的项目使用的是 .net 4.0,而 xUnit 似乎使用的是 2.0。
我发现了一些帖子here 和here 等,说您可以编辑配置文件,但这对我不起作用。这两个帖子都有几年的历史了,他们甚至彼此都不同意。一个说条目应该是“supportedRuntime”,而另一个是“requiredRuntime”。但是,它们都不适合我。
我也考虑过下载源代码并使用 4.0 编译它,但根据网站,它需要 VS 2010。
在 IDE 中运行测试非常棒,但我还需要使用控制台运行程序才能在我们的构建机器上实现自动化测试。有没有办法让它工作?还是不再维护 xUnit?
我还找到了another post,据说该问题早在 2010 年就已修复。也许这是回归失败?
【问题讨论】: