WriteLinesToFile Task

Writes the paths of the specified items to the specified text file.

The following table describes the parameters of the WriteLinestoFile task.

Parameter

Description

File

Required ITaskItem parameter.

Specifies the file to write the items to.

Lines

Optional ITaskItem[] parameter.

Specifies the items to write to the file.

Overwrite

Optional Boolean parameter.

If true, the task overwrites any existing content in the file.

The following example uses the WriteLinesToFile task to write the paths of the items in the MyItems item collection to the file specified by the MyTextFile item collection.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

    <ItemGroup>
        <MyTextFile Include="Items.txt"/>
        <MyItems Include="*.cs"/>
    </ItemGroup>

    <Target Name="WriteToFile">
        <WriteLinesToFile
            File="@(MyTextFile)"
            Lines="@(MyItems)"
            Overwrite="true"/>
    </Target>

</Project>
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft