I have file pro.build
:
<?xml version="1.0" ?>
<project name="NAnt.NUnit2ReportTasks" default="build" basedir=".">
<sysinfo />
<target name="nunitreport">
<nunit2report out="HTML_TestResults.html">
<fileset>
<includes name="NUnitTestResult.xml" />
</fileset>
</nunit2report>
<echo message="HTML Test report generated." />
</target>
</project>
From command prompt(DOS), I am giving command,
Nant -buildfile:pro.build
But I am getting error
Target 'build' does not exist in this project
Can you help me resolving this?
With <project>
's default
attribute you specify the target which should be executed if no other target is specified on the command line.
Problem: On the command line you're calling Nant -buildfile:pro.build
so you are not specifying a target there. NAnt tries to execute default target build
which is not present and fails.
Solution: Either you specify target nunitreport
on the command line by calling Nant -buildfile:pro.build nunitreport
. But since specifying a non-existent default target in your build file doesn't make much sense, I would suggest changing the default target:
<project name="NAnt.NUnit2ReportTasks" default="nunitreport" basedir=".">
<!-- ... -->
</project>