Using MSBuild, how to construct a dynamic string from iterating over files in an ItemGroup?

Posted by RyBolt on Stack Overflow See other posts from Stack Overflow or by RyBolt
Published on 2010-05-04T20:04:25Z Indexed on 2010/05/04 20:08 UTC
Read the original article Hit count: 194

Filed under:
|

I need to create multiple /testcontainer: parameters to feed into a task that exec's MsTest.

I have the following :

  <ItemGroup>
    <TestFiles Include="$(ProjectPath)\**\UnitTest.*.dll" />
  </ItemGroup>

for each match in TestFiles I would like to build a string like so:

"/testcontainer:UnitTest.SomeLibrary1.dll"
"/testcontainer:UnitTest.SomeLibrary2.dll"
"/testcontainer:UnitTest.SomeLibrary3.dll"

I am trying to use the internals of MSBuild without having to create a custom task, is this possible ?

TIA

© Stack Overflow or respective owner

Related posts about msbuild

Related posts about msbuild-task