ReadLinesFromFile Task
Reads a list of items from a text file.
The following example uses the ReadLinesFromFile task to create items from a list in a text file. The items read from the file are stored in the ItemsFromFile item collection.
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<MyTextFile Include="Items.txt"/>
</ItemGroup>
<Target Name="ReadFromFile">
<ReadLinesFromFile
File="@(MyTextFile)" >
<Output
TaskParameter="Lines"
ItemName="ItemsFromFile"/>
</ReadLinesFromFile>
</Target>
</Project>
format of the input file
The format of the text file is simply one item per line. From what I can tell, there can be no comments in the file and the file does not support adding metadata to the items that are read in.
- 4/2/2010
- Red Tiger
What is the format of the input file?
It may be obvious to people who already have lots of experience with MS Build, but for those of us who are just learning, documentation like this are very frustrating. So now I know that it is possible to read items from an external file. That is useful information, but now I have to go to google or trial and error to find out how the data in the input file need to be formatted.
I will come back and post an example when I find out.
Regards.
I will come back and post an example when I find out.
Regards.
- 7/7/2009
- wmchristie
Typo?
As far as I can see, there is a typo here.
ItemName="ItemsFromFile"
should be
PropertyName="ItemsFromFile"
- That's the only way I can get it working anyway :)
- 8/7/2008
- Øystein Garnes
- 8/10/2008
- Thomas Lee