Jeffrey Palermo (.com)

Sponsors

The Lounge

News

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Ramping up with NAnt for automated builds - level 300

At first glance, the NAnt .build files may seem daunting, especially the really long ones, but the documentation for NAnt is superb!

I wanted to start with a real VS solution instead of the trivial HelloWorld .cs file, so I used my Model-View-Presenter demo solution.  Since this was a Visual Studio solution, all I had to do was add a Solution task in the build file.

Here is my build file.  Now if that doesn't convince you that automated builds aren't that hard, I don't know what will!

<project name="Model View Presenter with Repository" default="rebuild">
    <property name="configuration" value="release"/>
   
    <target name="clean" description="Delete all previously compiled binaries.">
        <delete>
            <fileset>
                <include name="**/bin/**" />
                <include name="**/obj/**" />
                <include name="**/*.suo" />
                <include name="**/*.user" />
            </fileset>
        </delete>
    </target>
   
    <target name="build" description="Build all targets.">
        <call target="build.solution"/>
    </target>
   
    <target name="rebuild" depends="clean, build" />

    <target name="build.solution">
        <solution configuration="${configuration}" solutionfile="MVPWithRepository.sln" />
        <property name="expected.output" value="View/bin/${configuration}/View.exe"/>
        <fail unless="${file::exists(expected.output)}">Output file doesn't exist in ${expected.output}</fail>
    </target>
   
</project>


Posted 04-21-2005 7:31 AM by Jeffrey Palermo

[Advertisement]

Comments

Jeffrey Palermo wrote re: Ramping up with NAnt for automated builds - level 300
on 04-22-2005 4:46 PM
Thanks for the great example. This is exactly how I planned on easing into the NANT world (using the solution task instead of completely abandoning VS.NET), but still wasn't sure how painful it would be. This makes it clear that it should be a simple and straightforward.
Jeffrey Palermo wrote re: Ramping up with NAnt for automated builds - level 300
on 05-18-2005 11:26 PM
Trying to set up nant for the first time as a noob to it all.. this is the first decent full example that has got a build working. thank you!
Jeffrey Palermo wrote re: Ramping up with NAnt for automated builds - level 300
on 05-20-2005 5:28 AM
I blogged about my build automation adventures last year. I started with NAnt and still use it for one portion of the build but switched to Visual Build Pro for the overall process. For <$200 I was able to implement my full build process including source code checkout/mod/checkin, project building and moving to a staging area in one day.

I did some bits for assembling a Sql Upgrade Script using NAnt and blogged the associated code....
http://codebetter.com/blogs/steve.hebert/archive/category/1057.aspx
MarkItUp wrote Rebuilding solutions with NAnt and building Flash Projects
on 07-16-2005 10:40 PM
This last week I was with a customer helping them
Jason Meridth wrote re: Ramping up with NAnt for automated builds - level 300
on 02-10-2006 10:16 AM
Thank you. Thank you. Thank you.

I've been looking everywhere for a global delete to allow for rebuilds.

Very cool.