<script>

Executes the code contained within the task. This code can include custom extension function definitions. Once the script task has executed those custom functions will be available for use in the buildfile.

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

A static entry point named ScriptMain is required if no custom functions have been defined. It must have a single Project parameter.

The following namespaces are loaded by default:

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.85.2478.0)