Scratching the Itch

In my last post I explained a way to integrate nAnt into the IDE allowing a nAnt script in the editor or the solution explorer to be executed with a shortcut key.  I find this to be similar to macros and the command window, really somewhere in between the two.  Not quite as formal as a macro yet far more powerful than the command window.  This statement needs some support by itself you will most likely disagree with me.  I mentioned self contained projects in the last post and this is where I will start to support my statement.  Here is screenshot of the same project I was using as an example last time.

Build Directory

Notice the Packages directory is expanded.  It contains nAnt targets for all sorts of functionality.  The folder selected, VS.NETCompile, contains functionality related to compilation and VS.NET.  Below is the scratch file that was in the background of some the screenshots from the last post.

<?xml version=”1.0″ encoding=”utf-8″?>
<project xmlns=”http://nant.sf.net/schemas/nant.xsd” name=”scratch” default=”test” basedir=”..\Build” >
    <loadtasks assembly=”.\nAnt\bin\NAnt.Contrib.Tasks.dll” />
    <property name=”CCNetLabel” value=”Dev”/>
    <property name=”CCNetProject” value=”Doubler”/>
    <property name=”Compile.ConfigName” value=”Release”/>
    <include buildfile=”Properties.build.xml”/>
    <include buildfile=”Common.Build.xml” />
    <include buildfile=”.\Packages\Deployment\Deployment.Target.xml”/>
    <include buildfile=”.\Packages\VS.NETCompile\Compile.Target.xml” />

    <target name=”test”>
        <property name=”Compile.ConfigName” value=”release”/>
        <property name=”Compile.Bin” value=”${ProductDirectory}\ReleaseBin” />
        <property name=”Compile.ToCopyToBin” value=”true” />
        <property name=”Compile.ToDeployZip” value=”true”/>
        <property name=”Compile.ZipFileName” value=”Doubler.zip”/>
        <delete>
            <fileset>
                <include name=”${Compile.Bin}\*.*”/>
            </fileset>
        </delete>
        <call target=”Private.Compile.CopyToWorkingBin” />
        <call target=”Private.Compile.DeployZip” />
    </target>
</project>

This script will copy files compiled under the release configuration to the ReleaseBin and make a zip file name Doubler.zip, this is something that happens during the build.  I can tap into those build scripts calling just the bits and pieces that I need to accomplish a task.  The build scripts become a library of targets that I can call on; similar to tasks but providing functioality at a higher level.  And there it is, the support for the statement that nAnt scratch is more powerful than the command window and not as formal as macros.

kick it on DotNetKicks.com