I am refactoring my existing NAnt build scripts to be able to use them on just about any project and have the proper values sent over from CruiseControl .NET. I've come across an issue, though, where the Target isn't being set correctly.
I have defined my call to NAnt as follows:
<tasks>
<nant>
<executable>$(NAntExecutablePath)</executable>
<buildFile>D:\ci\default.build.xml</buildFile>
<!--baseDirectory></baseDirectory-->
<buildArgs>
-D:SolutionFile="$(Batch_WorkingFolderTrunk)\MySolution.sln"
-D:LocalDeployRoot=D:\ci\deploy\MyProject
</buildArgs>
<targetList>
<target>build</target>
</targetList>
</nant>
</tasks>
and my build file has the required required tasks
<target name="clean">
<exec program="${MSBuildPath}">
<arg line='"${SolutionFile}"' />
<arg line="/property:Configuration=${SolutionConfiguration}" />
<arg value="/target:Clean" />
<arg value="/verbosity:normal" />
<arg value="/nologo" />
<arg line='/logger:"${CcnetMsbuildLoggerPath}"' if="${file::exists('${CcnetMsbuildLoggerPath}')}"/>
</exec>
<delete>
<fileset basedir=".">
<include name="bin\**\*" />
<include name="TestResults\**\*" />
</fileset>
</delete>
</target>
<target name="build" depends="clean">
<delete>
<fileset basedir="${LocalDeployRoot}">
<include name="**\*"/>
</fileset>
</delete>
<exec program="${MSBuildPath}">
<arg line='"${SolutionFile}"' />
<!--arg line='/property:Configuration="${SolutionConfiguration}"' /-->
<arg line='/property:OutputPath="${LocalDeployRoot}"' />
<!--arg line='/property:Platform="${SolutionPlatform}"' /-->
<arg value="/target:Rebuild" />
<arg value="/verbosity:normal" />
<arg value="/nologo" />
<arg line='/logger:"${CcnetMsbuildLoggerPath}"' if="${file::exists('${CcnetMsbuildLoggerPath}')}"/>
</exec>
</target>
My error message states
Target framework: Microsoft .NET Framework 4.0 Target(s) specified:
build[echo] Starting the build script
BUILD FAILED
Target ' ' does not exist in this project.
Total time: 0.1 seconds.
Any ideas out there?
I can run the NAnt script successfully via the command line:
D:\ci>nant-0.91\bin\nant.exe /f:default.build.xml build -D:SolutionFile="D:\ci\code\MyProject\MySolution.sln" -D:LocalDeployRoot=D:\ci\deploy\MyProject