1

I would like to implement a Msbuild Custome task to loop a list of items and do something about each item. Basically I would liketo build a foreach or for loop in msbuild.

I have searched around but didn't find much useful information about output a list of items and loop though each of them

What I got

How to implement Custom Tasks http://blogs.msdn.com/b/msbuild/archive/2006/01/21/515834.aspx

Return output from a custom msbuild task

Return output from an MsBuild task?

Is it possible to implement my though with msbuild custom task?

Update:

I would like something

<Foreach item='String' in="PropertyGroups" Property='MyPropertyName'>
   //do what ever to use $(MypropertyName) for other tasks
</Foreach>
Community
  • 1
  • 1
icn
  • 17,126
  • 39
  • 105
  • 141

1 Answers1

2

Standard MSBuild tasks operate on collections (ItemGroup in MSBuild-ese, ITaskItem[] in the ITask interface) and custom tasks can do the same. You don't need a foreach.

Your task, if you need a custom task, would look like this:

<MyTask TaskItems="@(blah)"/>
Ritch Melton
  • 11,498
  • 4
  • 41
  • 54