According to the project structure shown in Figure 1, each project directory should contain a build file that at least supports the standard targets defined for the type to which it belongs. There are mainly two build file types:
Master build file
Slave build file
A master build file provides targets for creating zip archives, installing artifacts, generating documentation, and of course, building the project itself. But most of the times, building a project means building a number of subprojects, which are not built directly by the master build file. Instead, the master build file just delegates to one or more slave build files. Normally, there is only one master build file per project, and it resides in the project's top directory. Master build files should at least support the targets described in Table 1.
Table 1. Target Supported by Master Build Files
| Target | Description |
|---|---|
| build | Builds the project. This target runs NAnt on all subprojects' build files by specifying build as the target. Most of the times build is the default target. |
| test | Performs unit tests. This target runs NAnt on all subprojects' build files by specifying test as the target. |
| clean | Deletes all the files generated by the build, test, and doc targets. After executing this target, the project is in a clean slate. |
| install | Installs project artifacts on the native system. This target depends on the build and doc targets. |
| uninstall | Uninstalls project artifacts from the native system. |
| package | Creates a zip archive containing the distribution files (executables, documentation, etc.). To create a zip archive containing the source files only, just specify the src configuration before the package target. More on configurations in the section called “Configurations”. |
A slave build file provides the targets for building and testing a subproject. Slave build files should function either when processed directly by invoking NAnt from the location where they reside, or when called through the master build file or any other slave build file. Slave build files should at least support the targets described in Table 2.
Table 2. Target Supported by Slave Build Files
| Target | Description |
|---|---|
| build | Builds the current subproject. Most of the times this is the default target. |
| test | Performs unit tests. Tests should be based on NUnit . |
| clean | Deletes all the files generated by the build and test targets. After executing this target, the subproject is in a clean slate. |
Appendix A, Build File Examples provides an example for each build file type discussed in this section.