Can we use nant to build .sln files in C#?
The easiest approach in my experience is to use NAnt to call MSBuild, and get MSBuild to build the solution file itself. See my Protocol Buffers build file as an example.
I use NAntContrib which has an msbuild
task:
<property name="nantcontrib-dir"
value="${path::combine(nant::get-base-directory(), '../../NAntContrib')}"
overwrite="false" />
<loadtasks assembly=
"${path::combine(nantcontrib-dir, 'bin/NAnt.Contrib.Tasks.dll')}"
/>
...
<target name="build"
description="Builds all C# code">
<msbuild project="${src}/ProtocolBuffers.sln">
<property name="Configuration"
value="${build-configuration}" />
</msbuild>
</target>
msbuild task that can either just build your solution or execute an entire msbuild script:
<target name="compile">
<msbuild project="xxx.sln">
<arg value="/property:Configuration=release" />
<arg value="/t:Rebuild" />
</msbuild>
</target>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With