views:

2126

answers:

1

It looks like there are (at least) two options for getting nant to use csproj files: using the task of NAntContrib or using msbuild.exe directly (e.g., codecampserver). Am I reading this right, and if so, what is the advantage of using msbuild.exe over the NAntContrib task?

+4  A: 

The NAntContrib assumes .NET Framework V2.0. If you want to use .NET 3.5, you'll need to use MsBuild.exe.

Here's an example:

<property name="MSBuildPath" value="C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe"/>    
    <target name="build">
     <exec program="${MSBuildPath}">
      <arg line='"${SolutionFile}"' />
      <arg line="/property:Configuration=${SolutionConfiguration}" />
      <arg value="/target:Rebuild" />
      <arg value="/verbosity:normal" />
      <arg value="/nologo" />
      <arg line='/logger:"C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll"'/>
     </exec>
    </target>
Babak Naffas
Wow, thanks. I never imagined that NAntContrib was so far behind.
Keith Morgan
-1 You can use <msbuild> with .NET 3.5. Make sure You have the latest nightlies of NAnt and NAntContrib (tested NAnt Nightly 20090130 and NAntContrib Nightly 20090201).
The Chairman