Parallel Class

MSBuild Extension Pack

Parallel Class MSBuild Extension Pack Help 4.0.12.0
Valid TaskActions are:

BuildTargetsInParallel (Required: Targets Optional: AdditionalProperties, ProjectFile, WaitAll, WorkingDirectory, MultiLog, MultiLogOpenOnFailure, MultiLogVerbosity, MultiLogResponseVerbosity, MultiProc, MaxCpuCount, NodeReuse)

BuildTargetSetsInParallel (Required: Targets Optional: AdditionalProperties, ProjectFile, WaitAll, WorkingDirectory, MultiLog, MultiLogOpenOnFailure, MultiLogVerbosity, MultiLogResponseVerbosity, MultiProc, MaxCpuCount, NodeReuse)

Remote Execution Support: NA

Inheritance Hierarchy

SystemObject  Microsoft.Build.UtilitiesTask
    MSBuild.ExtensionPackBaseTask
      MSBuild.ExtensionPack.FrameworkParallel

Namespace: MSBuild.ExtensionPack.Framework
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 4.0.0.0

The Parallel type exposes the following members.

Constructors

  NameDescription
Public methodParallel
Top
Properties

  NameDescription
Public propertyAdditionalProperties
Specifies additional properties to pass through to the new parallel instances of MSBuild.
Public propertyMaxCpuCount
Specifies the maximum number of concurrent processes to use when building. Use this with MultiProc parameter. Default is 0.
Public propertyMultiLog
Specifies whether each parallel execution should log to it's own log file rather than the parent. Default is false. For BuildTargetsInParallel you can specify a LogFilePath metadata value to define the root path to log to, otherwise they are written to the directory of the calling project. The name of the target is used as the file name. For BuildTargetSetsInParallel you can specify a LogFilePath and a LogFileName metatdatavalue. If LogFileName is not passed, the target name is used.
Public propertyMultiLogAppend
Specifies whether to append to existing log files. Default is false
Public propertyMultiLogOpenOnFailure
Specifies whether to open the log file containing the error info on failure. Default is false
Public propertyMultiLogResponseVerbosity
Specifies the verbosity of logging fed back to the calling task. Default is Minimal
Public propertyMultiLogVerbosity
Specifies the verbosity to log to the individual files with. Default is Diagnostic. Note this is case sensitive.
Public propertyMultiProc
Specifies whether or not to use the /m multiproc parameter. If you include this switch without specifying a value for MaxCpuCount, MSBuild will use up to the number of processors in the computer. Default is false.
Public propertyNodeReuse
Enable or disable the re-use of MSBuild nodes when using MultiProc. Default is false
Public propertyProjectFile
Speficies the MSBuild project to use. Defaults to the calling MSBuild file.
Public propertyTargets
Specifies the Targets to execute. Properties and Targets metadata can be set depending on the TaskAction. See the samples.
Public propertyWaitAll
Specifies whether to wait for all Targets to complete execution before returning to MSBuild or whether to wait for all to complete. Default is true.
Public propertyWorkingDirectory
Specifies the working directory. Default is null and MSBuild is resolved to the Path environment variable.
Top
Examples

<Project ToolsVersion="4.0" InitialTargets="Throttle" DefaultTargets="Normal;BuildTargetSetsInParallel;BuildTargetsInParallel" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath>
        <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath>
    </PropertyGroup>
    <Import Project="$(TPath)"/>
    <ItemGroup>
        <MyTargetSets Include="1">
            <LogFilePath>C:\b</LogFilePath>
            <LogFileName>Target1yahoo.txt</LogFileName>
            <Targets>Target1;Target2</Targets>
            <Properties>MyPropValue=MyPropValue1</Properties>
        </MyTargetSets>
        <MyTargetSets Include="2">
            <Targets>Target3</Targets>
        </MyTargetSets>
        <MyTargets Include="Target1">
            <Properties>MyPropValue=MyPropValue1</Properties>
        </MyTargets>
        <MyTargets Include="Target2;Target3">
            <LogFilePath>C:\b</LogFilePath>
        </MyTargets>
    </ItemGroup>
    <Target Name="Normal" DependsOnTargets="Target1;Target2;Target3"/>
    <Target Name="BuildTargetSetsInParallel">
        <MSBuild.ExtensionPack.Framework.Parallel MultiLog="$(MultiLog)" MultiLogAppend="$(MultiLogAppend)" MultiLogOpenOnFailure="$(MultiLogOpenOnFailure)" TaskAction="BuildTargetSetsInParallel" Targets="@(MyTargetSets)"  AdditionalProperties="SkipInitial=true"/>
    </Target>
    <Target Name="BuildTargetsInParallel">
        <MSBuild.ExtensionPack.Framework.Parallel MultiLog="$(MultiLog)" MultiLogAppend="$(MultiLogAppend)" MultiLogOpenOnFailure="$(MultiLogOpenOnFailure)" TaskAction="BuildTargetsInParallel" Targets="@(MyTargets)" AdditionalProperties="SkipInitial=true"/>
    </Target>
    <Target Name="Target1">
        <MSBuild.ExtensionPack.Framework.Thread TaskAction="Sleep" Timeout="1000"/>
        <Message Text="MyPropValue = $(MyPropValue)" Importance="High"/>
    </Target>
    <Target Name="Target2">
        <MSBuild.ExtensionPack.Framework.Thread TaskAction="Sleep" Timeout="4000"/>
    </Target>
    <Target Name="Target3">
        <MSBuild.ExtensionPack.Framework.Thread TaskAction="Sleep" Timeout="2000"/>
    </Target>
    <Target Name="Throttle" Condition="$(SkipInitial) != 'true'">
        <MSBuild.ExtensionPack.Framework.Thread TaskAction="Sleep" Timeout="1000"/>
    </Target>
</Project>
See Also

Reference