Nant不启动nunit2任务
我有一个非常简单的watintest类,它是在visualstudio中构建和运行的。 现在我想构建它并与Nant一起启动。我已经编写了以下nant.build文件:Nant不启动nunit2任务,nunit,nant,Nunit,Nant,我有一个非常简单的watintest类,它是在visualstudio中构建和运行的。 现在我想构建它并与Nant一起启动。我已经编写了以下nant.build文件: <?xml version="1.0"?> <project name="WatinTests" default="build"> <property name="build.dir" value="c:WatinTests\bin\" /> <property name="pro
<?xml version="1.0"?>
<project name="WatinTests" default="build">
<property name="build.dir" value="c:WatinTests\bin\" />
<property name="project.rootdirectory" value="." />
<property name="solution.dir" value="."/>
<property name="solution.file" value="${solution.dir}/WatinTests.csproj"/>
<property name="build.configuration" value="debug" />
<property name="nant.settings.currentframework" value="net-4.0" />
<mkdir dir="${build.dir}" />
<target name="build">
<exec
program="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe"
commandline="${solution.file} /t:Clean /p:Configuration=${build.configuration} /v:q"
workingdir="."
output="${build.dir}/WatinTests.dll" />
</target>
<target name="test" depends="build">
<nunit2>
<formatter type="Plain" />
<test assemblyname="${build.dir}WatinTests.dll" />
</nunit2>
</target>
</project>
成功执行第一个任务-waintests.dll文件进入\bin目录。
但测试并没有启动。以下是输出:
构建文件:file:///c:/WatinTests/nant.build 目标框架:
指定的Microsoft.NET Framework 4.0目标:生成测试
建造:
测试:
构建失败
c:\waintests\nant.build(14,6):执行测试失败。如果你
程序集不是使用NUnit版本2.6.0.12051生成的,请确保
已经重定向了assembly绑定。请参阅
任务以获取更多信息。
无法加载文件或程序集“waintests.dll”或其依赖项之一。试图加载带有错误代码的程序
格式。
无法加载文件或程序集“waintests.dll”或其依赖项之一。试图加载带有错误代码的程序
格式
这里出了什么问题?如中所述,是否将程序集绑定重定向添加到app.config中:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.8.0" newVersion="2.2.8.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
看看这个。