我正在尝试在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>
请指教?
答案 0 :(得分: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>