Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run tasks in parallel in MSBuild

Unless I've grossly misunderstood MSBuild, tasks are executed in the document order in which they appear within a 'Target' node.

I'd like to be able to specify that two tasks (such as xcopy tasks) could run in parallel. I was expecting there to be a 'Parallel' task or something...?

like image 954
Pete Montgomery Avatar asked Jun 15 '09 16:06

Pete Montgomery


People also ask

Does MSBuild use multiple cores?

MSBuild can take advantage of systems that have multiple processors, or multiple-core processors. A separate build process is created for each available processor. For example, if the system has four processors, then four build processes are created.

How do I create multiple projects in MSBuild?

You can use MSBuild to build multiple projects faster by running them in parallel. To run builds in parallel, you use the following settings on a multi-core or multiple processor computer: The -maxcpucount switch at a command prompt. The BuildInParallel task parameter on an MSBuild task.

How do I run MSBuild task?

To execute a task in an MSBuild project file, create an element with the name of the task as a child of a Target element. If a task accepts parameters, these are passed as attributes of the element. Tasks can also return information to the project file, which can be stored in items or properties for later use.


1 Answers

Try the new parallel task in the MSBuild Extension Pack - http://mikefourie.wordpress.com/2012/02/29/executing-msbuild-targets-in-parallel-part-1

like image 160
Mike Fourie Avatar answered Sep 20 '22 00:09

Mike Fourie