views:

893

answers:

3

Hi,

Could anyone provide any example of NAnt script for C++ project build automation?

Thanks!

A: 

If the project is in Visual Studio then you can use the <Solution> task, I think. That's the simplest/ugliest way of doing it.

edit: Just realised that SO filtered out my little XML tag there.

endian
+1  A: 

If you're talking Microsoft Visual C++ then I think you get the most control by shelling out msbuild.exe from the nant script and passing it your solution file on the command line. This is supported in Visual Studio 2005/.Net Framework 2.0 and above. e.g.:

<property name="msbuild.dir" value="C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727" />

...

<exec program="${msbuild.dir}\MSBuild.exe"
    commandline="/p:Configuration=Release .\MySolution.sln" 
/>

It will build everything in your solution regardless of language (c#, VB, C++, etc)

Mike

mjmarsh
Any advantages to using exec instead of the MSBuild task in NAntContrib?(http://nantcontrib.sourceforge.net/release/latest/help/tasks/msbuild.html)
MattyT
A: 

I was recently looking for this kind of information, and found this blog entry about it: http://seclib.blogspot.com/2005/05/building-native-c-projects-with-nant.html

Ricky AH