Transform an ItemGroup into a Delimited String

5.2k views Asked by At

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?

1

There are 1 answers

1
Ludwo On BEST ANSWER

Try to use MSBuild transforms like this:

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