At first look it is powerful tool allows me easy to build project, run tests and package release.
The first task was"build" of course.
For such purpose NAnt offers <csc>
Is there a way to build VS project with NAnt? Yes, you may find it in NAntContrib. It provides <msbuild>
Is there alternative way to build *.csproj? Yes - msbuild command line!
NAnt has <exec>
There is my Default.build file:
<?xml version="1.0" ?>
<project name="IZWebFileManager" default="build"
xmlns="http://nant.sf.net/schemas/nant.xsd">
<property name="project.config" value="Debug" />
<target name="clean">
<exec program="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe"
commandline='/t:Clean /p:Configuration=${project.config} /p:Platform="AnyCPU" /v:n'
workingdir="." />
</target>
<target name="version">
</target>
<target name="build" depends="clean, version">
<exec program="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe"
commandline='/t:Build /p:Configuration=${project.config} /p:Platform="AnyCPU" /v:n'
workingdir="." />
</target>
</project>
I place Default.build file near to *.csproj file and msbuild find it by default, so there is no need to mention name of project file explicitly.
Run build using command line:
>nant build
P.S. After a while I figured out <solution> task. Looks like that is what I need to run msbuild with NAnt. I will discover it...
No comments:
Post a Comment