msbuildtransformitemgroup

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?


Solution

  • Try to use MSBuild transforms like this:

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