The version nant references is different than the version that you are using in 
your own app. Use the exec task instead of the nunit2 task.

http://www.hanselman.com/blog/CallingNUnitFromNAntPragmatically.aspx

BOb


> -----Original Message-----
> From: Steven Whatmore [mailto:steven.whatm...@purefacts.com]
> Sent: Tuesday, November 03, 2009 1:06 PM
> To: nant-users@lists.sourceforge.net
> Subject: [NAnt-users] nANT and nUnit2 integration and running test.
> 
> Good afternoon,
> 
> I am trying to integrate my unit testing into a nightly build
> process and am having one hell of a time getting the test to run
> successfully.
> 
> My unit test run fine from Visual Studio and using the test runner
> GUI but am receiving the following error when I run it from nANT.
> 
> Failure executing test(s). If you assembly is not built using NUnit
> version 2.2.8.0, then ensure you have redirected assembly bindings.
> Consult the documentation of the <nunit2> task for more
> information.:
> NAnt.Core.BuildException: C:\Projects\PureFees-Net\PureFees-Net
> \PureFees-Net-nUnit.build(14,10):
> Failure executing test(s). If you assembly is not built using NUnit
> version 2.2.8.0, then ensure you have redirected assembly bindings.
> Consult the documentation of the <nunit2> task for more
> information.
> ---> System.IO.FileNotFoundException: Could not load file or
> assembly
> 'PureFees-Net-TestSuite' or one of its dependencies. The system
> cannot find the file specified.
> File name: 'PureFees-Net-TestSuite'
>   at (wrapper xdomain-invoke) NUnit.Core.ProxyTestRunner:Load
> (string)
>   at NAnt.NUnit2.Tasks.NUnit2Task.ExecuteTask () [0x00000]
>   --- End of inner exception stack trace ---
>   at NAnt.NUnit2.Tasks.NUnit2Task.ExecuteTask () [0x00000]
>   at NAnt.Core.Task.Execute () [0x00000]
> 
> The documentation on how to properly configure this is not 100%
> clear.
> 
> The same test runs successfully on the build machine by directly
> loading the project into the GUI but the nANT nUnit2 task does not.
> 
> I have tried many variations of the configuration of the test and
> the nUnit task but with no luck.
> 
> I must be missing something obvious (or not so obvious in this
> case)
> 
> Here is my nANT file
> 
> <?xml version="1.0" ?>
> <project name="Test1" default="solutionTest"
> xmlns="http://nant.sf.net/schemas/nant.xsd";>
> 
>     <property name="basedir" value="${project::get-base-
> directory()}" />
> 
>     <property name="build.debug" value="false" />
>     <property name="project.version" value="0.0.1" />
>     <property name="current.build.dir" value="${basedir}\\build" />
> 
>     <target name="solutionTest">
> 
>         <loadtasks assembly="C:\DEV\Microsoft\nant-0.86-
> beta1\bin\NAnt.Contrib.Tasks.dll" />
> 
>         <nunit2 verbose="true">
>             <formatter type="Xml" />
>             <test assemblyname="Test-Net-TestSuite.dll"
> appconfig="Test-Net-QC.nunit" />
>         </nunit2>
> 
>     </target>
> 
> </project>
> 
> And here is my Test-Net-QC.nunit
> 
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
>     <runtime>
>         <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
>             <dependentAssembly>
>                 <assemblyIdentity name="nunit.framework"
> publicKeyToken="96d09a1eb7f44a77" culture="Neutral" />
>                 <bindingRedirect oldVersion="2.0.6.0"
> newVersion="2.2.8.0" />
>                 <bindingRedirect oldVersion="2.1.4.0"
> newVersion="2.2.8.0" />
>             </dependentAssembly>
>         </assemblyBinding>
>     </runtime>
> </configuration>
> 
> Thanks in advance.
> 
> Whatty
> 
> 
> -------------------------------------------------------------------
> -----------
> Come build with us! The BlackBerry(R) Developer Conference in SF,
> CA
> is the only developer event you need to attend this year. Jumpstart
> your
> developing skills, take BlackBerry mobile applications to market
> and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register
> now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> NAnt-users mailing list
> NAnt-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nant-users

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to