I will use the NAnt master build, simple dll, simple exe, and winform exe templates all taken from Chapter 4. Listing 9.2 shows the master build file.
NAnt 0.8.2 was used for this chapter.
<projects> <!-- ASpell.Net --> <project> <name>aspell.net\aspell.net</name> </project> <!-- Tests --> <project> <name>tests\nunit\nunit</name> <dependencies> <dependency>aspell.net</dependency> </dependencies> </project> <project> <name>tests\ConsoleAppTester\ConsoleAppTester</name> <dependencies> <dependency>aspell.net</dependency> </dependencies> </project> <!-- Examples --> <project> <name>examples\WindowsApp\WindowsApp</name> <dependencies> <dependency>aspell.net</dependency> </dependencies> </project> <project> <name>examples\WordPadSpell\WordPadSpell</name> <dependencies> <dependency>aspell.net</dependency> </dependencies> </project> </projects>
Notice that all the example projects are dependent upon the ASpell.NET project. Listing 9.3 shows that after the transform of the project file and building all the subprojects, the setup project is run, and the iso file is created. At this point, the file could be distributed a number of different ways, but Listing 9.3 uses SCP (secure copy) to upload the file to a server.
<project name="Master Build" basedir="." default="build">
<sysinfo verbose='true'/>
<!-- General Build Properties -->
<property name="debug" value="true" />
<property name="define" value="DEBUG;TRACE" />
<property name="build.dir" value="C:\book" />
<property name="refassemblies" value="${build.dir}\refassemblies " />
<property name="isofile" value="release.iso" />
<!-- MSI Properties -->
<property name="product.name" value="ASpell.NET" />
<property name="company.name" value="OpenSource.NET" />
<property name="msi.version" value="1.0.2" />
<property name="msi.guid.product"
value="{D9C16B65-BD89-44f5-AEC8-16775D4A3619}" />
<property name="msi.guid.upgrade"
value="{42D979E5-E2E8-45c6-89D4-378353848479}" />
<!-- Location to output the complete msi -->
<property name="output.dir" value="${build.dir}\output" />
<target name='build'>
<exec program=îNantHelper.exeî
commandline=îprojects.xmlî output=îprojects
.txtî basedir=î.î />
<!-- After applying Helper application transform
pass the target to the subprojects -->
<foreach item='Line' property='filename' in='projects.txt'>
<nant buildfile='${build.dir}\${filename}.build' target='build' />
</foreach>
<msi
sourcedir="${output.dir}"
license="license.rtf"
output="${company.name}.${product.name}.msi"
debug="true"
verbose="true"
>
<properties>
<property name="ProductName" value="${product.name}" />
<property name="ProductVersion" value="${msi.version}" />
<property name="Manufacturer" value="${company.name}" />
<property name="ProductCode" value="${msi.guid.product}" />
<property name="UpgradeCode" value="${msi.guid.upgrade}" />
</properties>
<directories>
<directory name="D__BINDIRECTORY" foldername="bin" root="TARGETDIR" />
</directories>
<components>
<component name="C__MainFiles"
attr="2"
directory="TARGETDIR" feature="F__DefaultFeature">
<key file="Test.xml" />
<fileset basedir="${build.dir}">
<includes name="*.*" />
</fileset>
</component>
</components>
<features>
<feature name="F__DefaultFeature" title="${product.name} Main Feature"
display="1" typical="true" directory="TARGETDIR">
<description>${product.name} core files.</description>
</feature>
</features>
</msi>
<mkisofs isofilename='${build.dir}\${isofile}' inputdir='output.dir' />
<scp file='${build.dir}\${isofile}' server="ReleaseServer" path="~" />
</target>
</project>
Figure 9-1 is the assurance that the NAnt build, complete with NUnit and NDoc integration, is working.
Before continuing any further, we should set up a Source Code Management (SCM) system.