Currently there is very little help for people to build large projects with nant in a maintainable way. I've been working on this problem for a while now and believe I've found a design that works well for small and large projects. I'm going to continue to refine this design and document it as a best practice but I wanted to give an advance preview and gets a bit of feedback.
Attached is an example project that simulates a project with 2 libraries with 2 examples. From inspection you can see how this design would scale well to a much larger example. This is the basis for the design. The key to this design is the a modified <include> task. The modification does two things: 1. It removes the build exception if you do a recursive include and simply ignores it without doing the include (something like an include once). 2. When tasks are executed in the included build files the base directory changes to be where the build file is located. So if you have a <csc> task in an included build file the path to the source files should be relative to the build file. Currently the path needs to be relative to the buildfile doing the including. What these changes allow is the ability to have a small buildfile for each sub project that is standalone but includes all the information about the entire project so that dependencies can be done and compiler settings can be stored in a central location. To try this out I've included a hacked version of nant with this change. To get this going do the following: 1. Unzip the attached file into a directory (say d:\include-test). 2. Open a command prompt and cd to that directory 3. type "set PATH=%cd%\bin" to place this version of nant in your path 4. type "nant" to simulate building the entire project 5. type "cd examples" to enter the examples folder 6. type "nant" to build all the examples and libraries they depend on 7. type "cd ..\libs\Alice" to enter the Alice library 8. type "nant" to build only the Alice library (and any dependent). 9. type "nant foo" to build the foo example from the Alice directory Now explore the build files to see how this works. The thing to notice is how we place dependencies for the example targets on the library targets. This means that any time you build an example program the library will also get built but because nant tasks are smart and they dependency checking inside nothing will actually happen if the library has never changed. This is a very good thing when working on large projects! If people still think the older <include> syntax is useful we could call this new task <import> but I don't really like the idea of having two ways of doing almost the same thing as it would be a bit confusing when to use what way. <<include-test.zip>>
include-test.zip
Description: Binary data