aolszowka
aolszowka

Reputation: 1400

Transform an ItemGroup into a Delimited String

My question is almost identical to Create an ItemGroup of strings in MSBuild however the solution offered there still seems to carry over the existing delimiter. Here's a simplified snippet of what I'm attempting to do:

<Target Name="Testing">
  <ItemGroup>
    <Files Include="$(RootDirectory)\*.*"/>
  </ItemGroup>

  <Message Text="@(Files->'%(Filename)%(Extension) ')"/>
</Target>

My desired output is something that looks like this:

file1.cs file2.cs file3.cs

However the snippet above produces the following output

file1.cs ;file2.cs ;file3.cs

What have I done wrong?

Upvotes: 17

Views: 5456

Answers (1)

Ludwo
Ludwo

Reputation: 6173

Try to use MSBuild transforms like this:

    <Message Text="@(Files->'%(Filename)%(Extension)', ' ')"/>

Upvotes: 36

Related Questions