未安装CLR版本4.0.30319的NUnit组件

pau*_*s_l 15 nunit

我正在尝试实现自动构建过程.构建之后,运行nunit-console.exe上的单元测试.显示以下错误:

> c:\nunit_2.5.10\nunit-console.exe c:\builds\Output\bin\TDD.nunit /framework=4.0.30319 /nologo /trace=Off
ProcessModel: Default    DomainUsage: Default
Execution Runtime: v4.0.30319
Unhandled Exception:
System.ArgumentException: NUnit components for version 4.0.30319 of the CLR are not installed
Parameter name: targetRuntime
   at NUnit.Util.TestAgency.LaunchAgentProcess(RuntimeFramework targetRuntime, Boolean enableDebug)
   at NUnit.Util.TestAgency.CreateRemoteAgent(RuntimeFramework framework, Int32 waitTime, Boolean enableDebug)
   at NUnit.Util.TestAgency.GetAgent(RuntimeFramework framework, Int32 waitTime, Boolean enableDebug)
   at NUnit.Util.ProcessRunner.Load(TestPackage package)
   at NUnit.ConsoleRunner.ConsoleUi.Execute(ConsoleOptions options)
   at NUnit.ConsoleRunner.Runner.Main(String[] args)
Run Code Online (Sandbox Code Playgroud)

构建计算机上没有nunit-agent.exe.但是,在我的机器上甚至没有调用它,所以我认为没有必要.

为什么在某些情况下需要nunit-agent.exe但并不总是需要?应该满足哪些条件,以便nunit-agent不需要启动?

编辑:我找到了一种资源,它描述了它是如何工作的,但不是很好:http://www.nunit.org/index.php?p = nunit-agent&r = 2.5.10.它说它是在程序需要在不同于NUnit使用的框架下运行时启动的(在这种情况下,因为NUnit是为2.0编译的).但是,在我的机器上,虽然条件似乎相同,但nunit-agent.exe不会运行.

Dav*_*den 13

我遇到了同样的错误,它肯定通过包含nunit-agent.exenunit-console.exe已启动的文件夹中解决.成功运行测试所需的完整.exes和.dlls 列表如下:

nunit.core.dll
nunit.core.interfaces.dll
nunit.framework.dll
nunit.util.dll
nunit-agent.exe
nunit-console.exe
nunit-console-runner.dll
Run Code Online (Sandbox Code Playgroud)

所有文件都打包在nunit.org提供的下载中.截至本文,2.6.3是当前版本.可以在此处找到控制台运行器的文档.和直接下载的zip文件是在这里.

对于面向.NET 4.5.1的测试程序集,以下语句将执行测试:

nunit-console.exe your-assembly.dll /framework=v4.5.1
Run Code Online (Sandbox Code Playgroud)