Killer NAnt Scripting Template

I created a NAnt template for developing NAnt scripts. This template includes global variables, comments, different targets based on the deployment, job, action structure that I have talked about previously.

I have provided the entire text file listed below, and also a zip file with the template in a NAnt .build file for download.

Download
Template

Template code:<project name="Killer.NAnt.Template" default="Deploy.Target" basedir="." ><!-- Ian Lintner --><!-- www.dotcodedump.com -->

  <!-- GLOBALS SECTION -->  <property name="Global.Debug" value="false" />    <property name="Global.Project" value="[Project Name]" />  <property name="Global.Email.From" value="[Email Address]" />  <property name="Global.Email.To" value="[Email Address]" />  <property name="Global.Email.Server" value="[Email Server]" />

  <!-- DEPLOYMENT SECTION -->

  <target name="Deploy.Target" description="A generic deployment target" >      <echo message="**************************************************************" />      <echo message="* === Begin Deploy Target 1 ===" />      <echo message="**************************************************************" />      <echo message="* Time: ${datetime::now()}" />      <echo message="**************************************************************" />

      <!--Put Deploy Specific Varaibles Here-->

      <!-- Put Jobs Here -->      <call target="Job.One" />

      <echo message=""/>      <echo message=""/>      <echo message="**************************************************************" />      <echo message="* === End Deploy Target 1 ===" />      <echo message="**************************************************************" />      <echo message="* Time: ${datetime::now()}" />      <echo message="**************************************************************" />  </target>

  <!-- JOB SECTION -->

  <target name="Job.One" >      <echo message="**************************************************************" />      <echo message="* -== Begin Task One==-" />      <echo message="* Time: ${datetime::now()}" />      <echo message="**************************************************************" />

      <!--Put Job Specific Variables Here-->

      <!-- Put Actions Here -->      <call target="Action.One" />      <call target="Action.Two" />

      <echo message=""/>      <echo message=""/>      <echo message="**************************************************************" />      <echo message="* -== End Task One==- " />      <echo message="* Time: ${datetime::now()}" />      <echo message="**************************************************************" />  </target>

  <!-- ACTION SECTION -->

  <target name="Action.One" >      <echo message="**************************************************************" />      <echo message="* Begin Action One: ${datetime::now()}" />      <echo message="**************************************************************" />

      <!-- put tasks here -->      <echo message="   *** Task One ***"/>

      <echo message="**************************************************************" />      <echo message="* End Action One: ${datetime::now()}" />      <echo message="**************************************************************" />

  </target>

  <target name="Action.Two" >      <echo message="**************************************************************" />      <echo message="* Begin Action Two: ${datetime::now()}" />      <echo message="**************************************************************" />

      <!-- put tasks here -->      <echo message="   *** Task Two ***"/>

      <echo message="**************************************************************" />      <echo message="* End Action Two: ${datetime::now()}" />      <echo message="**************************************************************" />  </target>

</project>

View All of the Killer Nant Scripting Articles

Post a Comment

Your email is never shared. Required fields are marked *

*
*
Profile Picture

About Ian Lintner


I am a software developer, mostly web,  in Des Moines, Iowa. I take a very opinionated stand concerning development, you will never regret a simple design or architecture. My education was at Drake University in Biology and Computer Science. Offline I am recently married to my wife Heather. I try my hand at many hobbies currently I am gardening till the snow comes in.



My Current Projects


Des Moines Twitter Trends