Export (0) Print
Expand All

ReadLinesFromFile Task

Reads a list of items from a text file.

The following table describes the parameters of the ReadLinesFromFile task.

Parameter Description

File

Required ITaskItem parameter.

Specifies the file to read. The file must have one item on each line.

Lines

Optional ITaskItem[] output parameter.

Contains the lines read from the 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>

Community Additions

ADD
Show:
© 2014 Microsoft