1

我正在尝试在 MsBuild 上使用 BuildInParallel 选项。

我有一个 NAnt & NAntContrib 脚本,例如

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

但我收到此错误消息:

Unexpected attribute "BuildInParallel" on element <msbuild>

请指教?

4

1 回答 1

2

nant-contrib的MSBuild任务没有BuildInParallel属性。您必须使用Maxcpucount命令行参数。

<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>  
于 2010-06-29T18:07:49.213 回答