I'm just starting to use NAnt. I worked from a tutorial and just tried to set a goal to clear my solution during assembly. The structure of my Visual Studio Solution is as follows:
- Solutions folder
- Project folder
- Project folder
- Tool folder
The NAnt.exe file is located in the Tools / NAnt folder. The .build file is also located here. Here is my .build file:
<?xml version="1.0" encoding="utf-8" ?> <project name="NAntTest" default="build" xmlns="http://nant.sf.net/release/0.86-beta1/nant.xsd"> <property name="solution.file.name" value="NAntTest.sln" /> <property name="project.config" value="debug" /> <target name="build" depends="clean.source" /> <target name="clean.source"> <exec program="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe" commandline="${solution.file.name} /t:Clean /p:Configuration=${project.config} /v:q" workingdir="."/> </target> </project>
This is how the following example was formatted. If I try to run this assembly, I get an error that the project file does not exist. For the purpose of clean.source, if I replace the workdir attribute with a hard-coded path to my solution base folder, the script compiles and runs correctly. Obviously, this is not ideal for portability if I need to move the project anywhere.
How do I get NAnt to see the base working directory?
build-process build-automation visual-studio build nant
Mark struzinski
source share