Bruce,

This has always been somewhat problematic with the nUnit console and nAnt.

I ran into the same problem and had a hell of a time resolving it myself but 
what I found was that if you are including the nUnit DLL(s) in your project the 
easiest way to get this to work is to make sure that you have the same version 
in your project as what nUnit / nAnt are looking for and the problem goes away. 
Now this gets a little more complicated if you are using libraries which are 
bound to a particular version of the nUnit framework - which was exactly the 
case in my project where I was using the Spring.NET framework which was 
compiled against an older versio. Luckily the Spring team provided me with a 
newer version of the component library that was compiled against the correct 
version and it all worked.

Hope that helps somewhat 

Whatty 


-----Original Message-----
From: Bruce Scharlau [mailto:b.schar...@abdn.ac.uk] 
Sent: Monday, July 05, 2010 4:33 AM
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] problems with nunit-console and nant

Hi all,

I'm trying to have nant build my dll files for source and test and then
run nunit-console over the test dll file, but it doesn't find the
nunit.framework.dll. I keep getting the

'could not load file or assembly nunit.framework, ... 2.5.5.10112 '
error. I used to get the one referencing 2.2.8.0 until I realised that
was the one nant was using.

I have tried putting the framework dll files on the system path, but
that doesn't seem to help either. I've also copied them into the same
directory as nunit-conlsole.exe and am including them on the compile steps.

So, is there a way to put the framework dll files on the path for the
command, or have I overlooked a step along the way?

I had been trying to use nunit2 task in nant, but that seemed a pain to
use, so figured this would be easier. The build file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<project name="ClassLibrary1" default="all-2">
  <target name="clean">
    <delete>
      <fileset>
        <include name="build/**" />
      </fileset>
    </delete>
  </target>
  <target name="compile-helper" depends="clean">
    <mkdir dir="build" />
    <csc target="library" output="build/Bank.dll">
      <sources>
        <include name="Bank.cs" />
      </sources>
    </csc>
  </target>
  <target name="compile-test" depends="compile-helper">
    <csc target="library" output="build/BankTest.dll">
      <sources>
        <include name="tests/BankTest.cs" />
         
      </sources>
      <references basedir="build">
        <include name="Bank.dll" />
          <include name="C:\Program Files (x86)\NUnit
2.5.5\bin\net-2.0\framework\nunit.framework.dll" />
      </references>
    </csc>
  </target>
  <target name="all" depends="compile-test">
      <mkdir dir="build/Results" />
      <nunit2>
      <formatter type="Xml" usefile="true" extension=".xml"
outputdir="build/Results" />
      <test assemblyname ="build/BankTest.dll" appconfig="app.config">
        <assemblies basedir="build">
          <include name="build/BankTest.dll" />
        </assemblies>
        <references basedir="build">
          <include name="build/Bank.dll" />
            <!-- include
name="${nant::scan-probing-paths('nunit.framework.dll')}" / -->
            <include name="C:\Program Files (x86)\NUnit
2.5.5\bin\net-2.0\framework\nunit.framework.dll" />
        </references>
      </test>
    </nunit2>
  </target>
    <target name="all-2" depends="compile-test">
        <exec program="nunit-console.exe"
              basedir="C:\Program Files (x86)\NUnit 2.5.5\bin\net-2.0"
              workingdir="C:\Users\bscharla\Documents\Visual Studio
2010\Projects\ClassLibrary1\ClassLibrary1"
            commandline="build/BankTest.dll /xml:results.xml /nologo" >
        </exec>
    </target>
    
</project>

 

-- 
 cheers,

 Bruce

 Dr. Bruce Scharlau
 Dept. of Computing Science
 Meston Building, Room 229
 University of Aberdeen
 Aberdeen AB24 3UE
 01224 272193
 http://www.csd.abdn.ac.uk/~bscharla
 mailto:b.schar...@abdn.ac.uk


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to