NAnt SDK Documentation - v0.92 |

# LoadFileTask Class

Load a text file into a single property.

For a list of all members of this type, see LoadFileTask Members.

System.Object
NAnt.Core.Element
NAnt.Core.Task
NAnt.Core.Tasks.LoadFileTask

[Visual Basic]
<TaskName(Name:="loadfile")>
Public Class LoadFileTask
Inherits Task
[C#]
[TaskName(Name="loadfile")]
public class LoadFileTask : Task

#### Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

#### Remarks

Unless an encoding is specified, the encoding associated with the system's current ANSI code page is used.

An UTF-8, little-endian Unicode, and big-endian Unicode encoded text file is automatically recognized, if the file starts with the appropriate byte order marks.

#### Example

Load file `message.txt` into property "message".

    <loadfile
        file="message.txt"
        property="message" />

Load a file using the "latin-1" encoding.

    <loadfile
        file="loadfile.xml"
        property="encoded-file"
        encoding="iso-8859-1" />

Load a file, replacing all `@NOW@` tokens with the current date/time.

    <loadfile file="token.txt" property="token-file">
        <filterchain>
            <replacetokens>
                <token key="NOW" value="${datetime::now()}" />
            </replacetokens>
        </filterchain>
    </loadfile>

#### Requirements

Namespace: NAnt.Core.Tasks

Assembly: NAnt.Core (in NAnt.Core.dll)

#### See Also

LoadFileTask Members | NAnt.Core.Tasks Namespace