Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we use nant to build .sln files in C#?

Tags:

c#

nant

Can we use nant to build .sln files in C#?

like image 724
user62958 Avatar asked Mar 09 '09 17:03

user62958


2 Answers

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>
like image 51
Jon Skeet Avatar answered Sep 20 '22 22:09

Jon Skeet


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>
like image 36
Darin Dimitrov Avatar answered Sep 19 '22 22:09

Darin Dimitrov