Using NAnt 0.85 with .net 4.0
Im guessing because the .net 4.0 framework is still in the beta stages, that’s why NAnt (and TeamCity) arnt supporting it, but from what I can tell, mstcthe method to build it hasnt changed since .net 2.0’s msbuild way of compiling a solution. Basically, all you need to do is call msbuild from the command line, give it the path of the solution, and off it goes to build it. You can specify additional information such as the build target etc, but its not essential.
Whereas normally, within NAnt, you would run the following:
<solution configuration="release" solutionfile="test.sln" />
This aparently dosent work with the .net 4.0 framework, it seems to not detect it. From what I can tell, the quickest way around this is to do the following:
<exec program="c:\Windows\Microsoft.NET\Framework64\v4.0.21006\MSBuild.exe" basedir="C:\SVN\CycleMania\" verbose="true" > <arg value="C:\SVN\CycleMania\CycleMania.sln" /> </exec>
Obviously, change the path in the program attribute to suit where Windows is located, and change the Framework64 to simply Framework if you are not running on a 64bit platform. One quirk that I fonud is that you have to have the BaseDir as where the solution is based, otherwise it throws errors about it cannot build properly.
And that should be it! If you are still struggling to compile on the .net 4.0 framework from within Nant, give me a shout.

