NUnit3 UnsupportedFrameworkException

问题描述 投票:0回答:2

我为我的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

谢谢。

c# nunit nunit-3.0 csc nunit-console
2个回答
1
投票

我会说你有一个不同版本的nunit runner比用于编译程序的nunit dll。你需要相同的版本(特别是不要试图结合nunit版本2和3)。

C#编译器和操作系统的版本在这里不重要。


0
投票

事实上,我的nunit跑步者(nunit-gui和nunit-console)的版本对于NUnit 3而言太旧了。我把它改成了TestCentric,现在它可以了!

© www.soinside.com 2019 - 2024. All rights reserved.