# <loadfile>

Load a text file into a single property.

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.

### Parameters

Attribute | Type | Description | Required
--- | --- | --- | ---
file | file | The file to load. | True
property | string | The name of the property to save the content to. | True
encoding | Encoding | The encoding to use when loading the file. The default is the encoding associated with the system's current ANSI code page. | False
failonerror | bool | Determines if task failure stops the build, or is just reported. The default is true. | False
if | bool | If true then the task will be executed; otherwise, skipped. The default is true. | False
unless | bool | Opposite of `if`. If false then the task will be executed; otherwise, skipped. The default is false. | False
verbose | bool | Determines whether the task should report detailed build log messages. The default is false. | False

### Nested Elements:

#### <filterchain>

The filterchain definition to use.

#### </filterchain>

### Examples

- 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

Assembly: NAnt.Core (0.91.4312.0)