Ever since I read the Pragmatic Programmer series of books, I have been a fan of automation. So the build process is one that I have tried to automate to the extent possible. The tool of choice for me in this case has been NAnt. At a high level, my build process consist of the following:
- Clean up the existing directory structure
- Prepare the directory structure
- Get the source from my Source Control Provider
- Build the solution
- Run Unit Tests
- and more...
Since the NAnt configuration file has to be manually coded, one of the challenges I was facing was to make sure that all of the details and dependencies of a multi-project Visual Studio solution were taken into account when I did the build and compile of the solution. In the past I've done the hand coding, or used Slingshot. But recently I've been using the <solution> task in NAnt and really like it.
In short, this particular NAnt task reads a VS.NET solution file, figures out all of the various project dependencies and does the build. Very nice.
Here is an example:
<target name="build" description="Build the solution" depends="init">
<solution configuration="${solution.config}"
solutionfile="${code.dir}\MySolution.sln"
outputdir="${stage.dir}\bin">
<excludeprojects>
<include name="${code.dir}\FirstProject\FirstProject.csproj"/>
<include name="${code.dir}\AnotherProject\AnotherProject.csproj"/>
</excludeprojects>
<webmap>
<map url=http://localhost/AnotherProject/Another.csproj
path="${code.dir}\AnotherProject\AnotherProject.csproj"/>
</webmap>
</solution>
</target>
br>