我在更大的构建文件中有以下NAnt目标:
<target name="load-gallio">
<loadtasks assembly="lib/Gallio.NAntTasks.dll" />
</target>
<target name="test" depends="load-gallio">
<gallio failonerror="true">
<files>
<include name="target/tests.dll" />
</files>
</gallio>
</target>
tests.dll与Gallio命令行运行器以及Icarus运行良好。当我运行“nant test”时,我得到以下内容:
load-gallio:
test:
[gallio] Gallio NAnt Task - Version 3.4 build 12
[gallio] Start time: 11:12
[gallio] Stop time: 11:12 (Total execution time: 0.881 seconds)
BUILD FAILED
INTERNAL ERROR
Gallio.Runtime.RuntimeException: Could not resolve component for service type 'Gallio.Runner.Projects.ITestProjectM
anager' because there do not appear to be any components registered and enabled for that service type.
at Gallio.Runtime.Extensibility.RegistryServiceLocator.ResolveNonDisabledDescriptor(Type serviceType)
at Gallio.Runtime.Extensibility.RegistryServiceLocator.Resolve[TService]()
at Gallio.Runner.TestLauncher.RunWithRuntime()
at Gallio.Runner.TestLauncher.Run()
at Gallio.NAntTasks.GallioTask.RunLauncher(TestLauncher launcher)
at Gallio.NAntTasks.GallioTask.InternalExecute()
at Gallio.NAntTasks.GallioTask.ExecuteTask()
at NAnt.Core.Task.Execute()
at NAnt.Core.Target.Execute()
at NAnt.Core.Project.Execute(String targetName, Boolean forceDependencies)
at NAnt.Core.Project.Execute()
at NAnt.Core.Project.Run()
为什么会这样?我错过了某种运行时设置/服务注册步骤吗?这是一个错误吗?提前感谢您的时间和帮助。
答案 0 :(得分:2)
我倾向于直接调用runners,因为它通常更灵活,并且通常会删除nant和实用程序之间的依赖关系。我不知道这是否适合您,但如果是一个例子可能是:
<exec program="gallio.echo.exe" basedir="Utilities" verbose="true">
<arg line="target/tests.dll"/>
<arg value="/rt:XML"/>
<arg value="/rd:Reports"/>
<arg value="/no-echo-results"/>
<arg value="/f:exclude Category:RunManually"/>
</exec>
可以找到命令行参数的完整文档here。