msbuildnantnantcontrib

Unexpected attribute "BuildInParallel" on element <msbuild>


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?


Solution

  • 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>