NUnit3 UnsupportedFrameworkException

时间:2019-02-19 21:49:02

标签: c# nunit nunit-3.0 csc nunit-console

我为c#程序进行了NUnit单元测试,但在使用NUnit 3.11.0进行测试时遇到了问题:我使用 csc 的以下命令编译了C#解决方案:

csc Program.cs ProgramTest.cs /r:nunit.framework.dll -out:Program.exe

当我在monodevelop中打开测试时,一切正常,但是当尝试使用nunit-console或nunit-gui打开可执行文件时,出现以下错误:

NUnit.Core.UnsupportedFrameworkException: Skipped loading assembly Program because it references an unsupported version of the nunit.framework, 3.11.0

也看到了herehere是nunit-gui给出的日志。

在我尝试使用较早版本的NUnit编译项目之前,遇到以下错误:

Program.cs(162,15): error CS0117: `NUnit.Framework.FileAssert' does not contain a definition for `Exists'

NUnit似乎不知道FileAssert.Exists()。这就是为什么我尝试使用NUnit 3.11.0对其进行编译的原因。

有人知道我如何使用NUnit3运行测试或使我的编译器知道 FileAssert.Exists()吗?

csc版本:

Microsoft (R) Visual C# Compiler version 2.8.2.62916 (2ad4aabc)

操作系统:Ubuntu 18.04

谢谢。

2 个答案:

答案 0 :(得分:0)

我要说的是,与用于编译程序的nunit dll相比,您具有不同版本的nunit运行程序。您需要相同的版本(尤其是不要尝试将nunit 2与3结合使用)。

此处的C#编译器和操作系统版本不重要。

答案 1 :(得分:0)

事实上,我的nunit运行程序版本(nunit-gui和nunit-console)太旧了 NUnit3。我将其更改为TestCentric,现在可以使用了!

相关问题