views:

794

answers:

3

I have a Visual Studio 2005 solution (.sln) with a mix of .NET and C++ projects. What is the best way to generate the .build file I will need to run my build process with NAnt. I'm new to using NAnt, and I'm not sure how to set it up. Will I have to update the .build file manually every time there is a new source file in any of the projects? Is there a tool that will generate the files for NAnt from the .sln and studio project files?

+4  A: 

There is no way that I know of to generate a .build file from an sln. There should be decent examples of .build files at nant.sourceforge.net

That being said there are two ways to build a .sln file from NAnt.

  • checkout nant.sourceforge.net or nant-contrib for built in or extended tasks to do this
  • use an "exec" task to shell out msbuild.exe to build the sln.

msbuild.exe has native support for sln files. You can build an sln file from the command line as follows:

msbuild.exe /p:Configuration=Debug /t:rebuild MySolution.sln

msbuild.exe can be found in your .NET Framework directory (e.g. C:\WINDOWS\Microsoft.NET\Framework\vX.XX.XXXX)

mjmarsh
A: 
NaV
A: 

With nant you will have to use the EXEC command to shell out to msbuild for the solution files.

Others have been experiencing the same issues.

Joshua Cauble
NAntContrib has an MSBuild task as @mjmarsh indicated.
Scott Saad
The problem comes from the fact that nAnt has been having targeting issues as there is a different version of MSBuild for 3.5. Alot of what I have seen on the net has you modifying hte registry in order to get the correct MSBuild version to execute. Thus why people are using the exec task.
Joshua Cauble