views:

17

answers:

1

Hi

I am trying to use the BuildInParallel option on MsBuild.

I have an NAnt & NAntContrib script e.g.

<project xmlns="http://nant.sf.net/release/0.90/nant.xsd" name="Css Manager Solution Build" ToolsVersion="3.5" default="deploy">

        <target name="clean" description="Delete all previously compiled binaries.">
            <delete>
                <fileset>
                    <include name="**/bin/**" />
                    <include name="**/obj/**" />
                    <include name="**/*.suo" />
                    <include name="**/*.user" />
                </fileset>
            </delete>
        </target>

      <target name="deploy" description="Build and deploy all targets.">
            <msbuild project="CssManager.sln" BuildInParallel="true">
                <property name="Configuration" value="${configuration}"/>
                <property name="OutDir" value="${bin.output.dir}"/>
            </msbuild>
      </target>

</project>

but I get this error message:

Unexpected attribute "BuildInParallel" on element <msbuild>

Please advise?

+1  A: 

The MSBuild task of nant-contrib doesn't have a BuildInParallel attribute. You'll have to use the Maxcpucount command line argument.

<target name="deploy" description="Build and deploy all targets.">
  <msbuild project="CssManager.sln" BuildInParallel="true">
    <property name="Configuration" value="${configuration}"/>
    <property name="OutDir" value="${bin.output.dir}"/>
    <arg value="/maxcpucount:${environment::get-variable('NUMBER_OF_PROCESSORS')}"/>
  </msbuild>
</target>  
madgnome
Thanks, but I get this message: <msbuild> does not support the nested build element "args".
Lucifer
I am using NAntContrib version 0.85.2479
Lucifer
My bad, syntax error. Replace args by arg.
madgnome
Thanks - My bad also - I checked the documentation but totally missed it.
Lucifer
As a side note, you can get the max by adding this: ${environment::get-variable('NUMBER_OF_PROCESSORS')}
Lucifer