1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2
<html xmlns="http://www.w3.org/1999/xhtml">
3
<!-- Documenting T:NAnt.Core.Tasks.SetEnvTask-->
5
<meta http-equiv="Content-Language" content="en-ca" />
6
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
<link rel="stylesheet" type="text/css" href="../style.css" />
8
<title><setenv> Task</title>
11
<table width="100%" border="0" cellspacing="0" cellpadding="2" class="NavBar">
13
<td class="NavBar-Cell">
14
<a href="http://nant.sourceforge.net">
17
<img alt="->" src="../images/arrow.gif" />
18
<a href="../index.html">Help</a>
19
<img alt="->" src="../images/arrow.gif" />
20
<a href="../tasks/index.html">Task Reference</a>
21
<img alt="->" src="../images/arrow.gif" /> <setenv></td>
22
<td class="NavBar-Cell" align="right">
26
<h1><setenv></h1>
27
<p> Sets an environment variable or a whole collection of them. Use an empty <code>value</code> attribute to clear a variable. </p>
29
<b>Note:</b> Variables will be set for the current NAnt process and all child processes that NAnt spawns (compilers, shell tools, etc). If the intention is to only set a variable for a single child process, then using the <a href="../tasks/exec.html"><exec></a> task and its nested <code>environment</code> element might be a better option. </p>
31
<b>Note:</b> Expansion of inline environment variables is performed using the syntax of the current platform. So on Windows platforms using the string %PATH% in the <code>value</code> attribute will result in the value of the PATH variable being expanded in place before the variable is set. </p>
37
<th style="text-align: center;">Type</th>
39
<th style="text-align: center;">Required</th>
42
<td valign="top">dir</td>
43
<td style="text-align: center;">directory</td>
44
<td> The value for a directory-based environment variable. NAnt will convert it to an absolute path. </td>
45
<td style="text-align: center;">False</td>
48
<td valign="top">file</td>
49
<td style="text-align: center;">file</td>
50
<td> The value for a file-based environment variable. NAnt will convert it to an absolute filename. </td>
51
<td style="text-align: center;">False</td>
54
<td valign="top">name</td>
55
<td style="text-align: center;">string</td>
56
<td> The name of a single Environment variable to set </td>
57
<td style="text-align: center;">False</td>
60
<td valign="top">path</td>
61
<td style="text-align: center;"><path></td>
62
<td> The value for a PATH like environment variable. You can use <code>:</code> or <code>;</code> as path separators and NAnt will convert it to the platform's local conventions. </td>
63
<td style="text-align: center;">False</td>
66
<td valign="top">value</td>
67
<td style="text-align: center;">string</td>
68
<td> The literal value for the environment variable. </td>
69
<td style="text-align: center;">False</td>
72
<td valign="top">failonerror</td>
73
<td style="text-align: center;">bool</td>
74
<td> Determines if task failure stops the build, or is just reported. The default is <b>true</b>. </td>
75
<td style="text-align: center;">False</td>
78
<td valign="top">if</td>
79
<td style="text-align: center;">bool</td>
80
<td> If <b>true</b> then the task will be executed; otherwise, skipped. The default is <b>true</b>. </td>
81
<td style="text-align: center;">False</td>
84
<td valign="top">unless</td>
85
<td style="text-align: center;">bool</td>
86
<td> Opposite of <code>if</code>. If <b>false</b> then the task will be executed; otherwise, skipped. The default is <b>false</b>. </td>
87
<td style="text-align: center;">False</td>
90
<td valign="top">verbose</td>
91
<td style="text-align: center;">bool</td>
92
<td> Determines whether the task should report detailed build log messages. The default is <b>false</b>. </td>
93
<td style="text-align: center;">False</td>
97
<h3>Nested Elements:</h3>
99
<!--NestedElementArray=T:NAnt.Core.Types.EnvironmentVariable-->
105
<div class="nested-element">
106
<p> Represents an environment variable. </p>
112
<th style="text-align: center;">Type</th>
114
<th style="text-align: center;">Required</th>
117
<td valign="top" class="required">name</td>
118
<td style="text-align: center;">string</td>
119
<td> The name of the environment variable. </td>
120
<td style="text-align: center;">True</td>
123
<td valign="top">dir</td>
124
<td style="text-align: center;">directory</td>
125
<td> The value for a directory-based environment variable. NAnt will convert it to an absolute path. </td>
126
<td style="text-align: center;">False</td>
129
<td valign="top">file</td>
130
<td style="text-align: center;">file</td>
131
<td> The value for a file-based environment variable. NAnt will convert it to an absolute filename. </td>
132
<td style="text-align: center;">False</td>
135
<td valign="top">if</td>
136
<td style="text-align: center;">bool</td>
137
<td> Indicates if the environment variable should be passed to the external program. If <b>true</b> then the environment variable will be passed; otherwise, skipped. The default is <b>true</b>. </td>
138
<td style="text-align: center;">False</td>
141
<td valign="top">path</td>
142
<td style="text-align: center;"><path></td>
143
<td> The value for a PATH like environment variable. You can use <code>:</code> or <code>;</code> as path separators and NAnt will convert it to the platform's local conventions. </td>
144
<td style="text-align: center;">False</td>
147
<td valign="top">unless</td>
148
<td style="text-align: center;">bool</td>
149
<td> Indicates if the environment variable should not be passed to the external program. If <b>false</b> then the environment variable will be passed; otherwise, skipped. The default is <b>false</b>. </td>
150
<td style="text-align: center;">False</td>
153
<td valign="top">value</td>
154
<td style="text-align: center;">string</td>
155
<td> The literal value for the environment variable. </td>
156
<td style="text-align: center;">False</td>
160
<h3>Nested Elements:</h3>
165
<<a href="../types/path.html">path</a>>
167
<div class="nested-element"> Sets a single environment variable and treats it like a PATH - ensures the right separator for the local platform is used. <p /></div>
171
</<a href="../types/path.html">path</a>>
180
<ul class="examples">
182
<p>Set the MONO_PATH environment variable on a *nix platform.</p>
184
<setenv name=="MONO_PATH" value="/home/jimbob/dev/foo:%MONO_PATH%"/>
188
<p>Set a collection of environment variables. Note the nested variable used to set var3.</p>
191
<variable name="var1" value="value2" />
192
<variable name="var2" value="value2" />
193
<variable name="var3" value="value3:%var2%" />
198
<p>Set environment variables using nested path elements.</p>
200
<path id="build.path">
201
<pathelement dir="c:/windows" />
202
<pathelement dir="c:/cygwin/usr/local/bin" />
205
<variable name="build_path" >
206
<path refid="build.path" />
208
<variable name="path2">
210
<pathelement dir="c:/windows" />
211
<pathelement dir="c:/cygwin/usr/local/bin" />
218
<h3>Requirements</h3>
219
<div style="margin-left: 20px;">
220
<b>Assembly:</b> NAnt.Core (0.90.3780.0)
b'\\ No newline at end of file'