Reputation: 95
I have the following in a AfterGet target in TFS.
<ItemGroup>
<AssemblyInfoFiles Include="$(SolutionRoot)\**\*assemblyinfo.cs" />
</ItemGroup>
<WriteLinesToFile
File="@(AssemblyInfoFiles)"
Lines="AssemblyInformationalVersion("$(LabelName)")]"
Overwrite="false"/>
The ItemGroup includes multiple files, but the WriteLinesToFile only expects a single file.
And logs the following error: error MSB4094: "XXXX;YYYY;ZZZZ" is an invalid value for the "File" parameter of the "WriteLinesToFile" task. Multiple items cannot be passed into a parameter of type "Microsoft.Build.Framework.ITaskItem".
How do I pass each item from the ItemGroup into the WriteLinesToFile Task?
Upvotes: 4
Views: 4843
Reputation: 15928
You can use batching : try
<ItemGroup>
<AssemblyInfoFiles Include="$(SolutionRoot)\**\*assemblyinfo.cs" />
</ItemGroup>
<WriteLinesToFile
File="%(AssemblyInfoFiles.FullPath)"
Lines="AssemblyInformationalVersion("$(LabelName)")]"
Overwrite="false"/>
Hope it helps !
Upvotes: 10