Reputation: 4174
I'm trying to combine all javascript files in a project during the build process, but it just isn't working for me. Here's what I have:
<Target Name="CombineJS">
<CreateItem Include=".\**\*.js">
<Output TaskParameter="Include" ItemName="jsFilesToCombine" />
</CreateItem>
<ReadLinesFromFile File="@(jsFilesToCombine)">
<Output TaskParameter="Lines" ItemName="jsLines" />
</ReadLinesFromFile>
<WriteLinesToFile File="all.js" Lines="@(jsLines)" Overwrite="true" />
</Target>
MSBuild is throwing an error on the ReadLinesFromFile
line saying there's an invalid value for the "File" parameter. (No error when there's only one file to combine)
So, two questions:
Upvotes: 10
Views: 3410
Reputation: 14164
Change line 6 to:
<ReadLinesFromFile File="%(jsFilesToCombine.FullPath)">
The @
operator is used when the input is ItemGroup which is essentially a semicolon-delimited list of strings.
The %
operator is for expanding ItemGroups into strings (properties).
Upvotes: 15
Reputation: 17731
The ReadLinesFromFileTask
you are using to read the files takes a single file as input to the File
property (MSDN). You can't use this task to read lines from multiple files at once. You may however be able to use batching to run the task several times for each file.
Upvotes: 2