Friday 4 July 2008

NANT Build for .Net 2.0 / 3.0 / 3.5

I have successfully automated the build process using Nant and Cruisecontrol tools for Framework 1.1. I am currently working on extending same for .Net Framework 2.0 , 3.0 and 3.5 .

NAnt 0.86 Beta 1 Release supports all the folowing Frameworks for .Net as per the release notes

.NET Framework 1.0
.NET Framework 1.1
.NET Framework 2.0
.NET Framework 3.5

Some of my collegues have faced problem in compiling VS 2005 projects with Nant and Cruisecontrol. They used something like this

<solution solutionfile="MySolution.sln" configuration="release" outputdir="c:\temp" />

I have spend some time to understand why they were facing problem in compiling these projects and found that some how Nant script was not interpreting the Solution files correctly and because of that they were facing issues.

The way i write build scripts for compiling is that rather than solution file in tag I specify a list of project files in a text file and mention that file in . And it works perfectly. Something like this

Option 1:


<solution configuration="release">
<projects>
<includesfile name="Myprojects.txt" />
</projects>
</solution>

OR
Option 2: You can also specify as follows


<solution configuration="release">
<projects>
<include name="Proj1\Proj1.vbproj" />
<include name="Proj2\Proj2.vbproj" />
</projects>
<referenceprojects>
<include name="ProjA\ProjA.vbproj" />
</referenceprojects>
</solution>

Option 1 is more flexible as you can easily add or remove projects or change order of compiling without touching your build script.

I will provide more samples in future post.

Today its "Happy Independence Day". So its time to enjoy fireworks.

No comments: