WriteLinesToFile Task 

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

Task Parameters

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.

Remarks

Example

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="https://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>

See Also

Concepts

MSBuild Tasks

Other Resources

MSBuild Task Reference