Question

I have a HelloNAnt.build file inside the directory:

D:\third party components\nant\WhatThis

My nant exe is placed at

C:\Program Files\nant

So I cd to D:\third party components\nant\WhatThis, type in the following command line:

"C:\Program Files\nant\bin\nant.exe" HelloNAnt.build

I got a build failed error, saying target HelloNAnt.build does not exist in this project.

What actually went wrong?

The content of HelloNAnt.build:

<?xml version="1.0"?>
<project name="Hello World" default="hello">
    <target name="hello">
        <echo>Hello</echo>
    </target>
</project>
Was it helpful?

Solution

You omitted the -buildfile option, which specifies the path to the buildfile that you want NAnt to run:

"C:\Program Files\nant\bin\nant.exe" -buildfile:HelloNAnt.build

However, in your case, you needn't provide any options at all. NAnt will search the current directory for a file with a .build extension and run it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top