<script>

Executes the code contained within the task.

Code

The <script> task must contain a single code element, which in turn contains the script code.

This code can include extensions such as functions, or tasks. Once the script task has executed those extensions will be available for use in the buildfile.

If no extensions have been defined, a static entry point named ScriptMain - which must have a single Project argument - is required.

Namespaces

The following namespaces are imported by default:

Assembly References

The assembly references that are specified will be used to compile the script, and will be loaded into the NAnt appdomain.

By default, only the NAnt.Core and mscorlib assemblies are referenced.

Parameters

Attribute Type Description Required
language string The language of the script block. Possible values are "VB", "vb", "VISUALBASIC", "C#", "c#", "CSHARP". "JS", "js", "JSCRIPT" "VJS", "vjs", "JSHARP" or a fully-qualified name for a class implementing CodeDomProvider. True
mainclass string The name of the main class containing the static ScriptMain entry point. False
prefix string The namespace prefix for any custom functions defined in the script. If ommitted the prefix will default to 'script' 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:

<references>

Any required references.

</references>

<imports>

The namespaces to import.

</imports>

<code>

The code to execute.

Represents an element of which the XML is processed by its parent task or type.

</code>

Examples

Requirements

Assembly: NAnt.DotNetTasks (0.91.4312.0)