Replacement Dynamic Value

This will replace any number of parameters into a format string. The format string can also include formats for each parameter.

Version

Available from version 1.5

Examples

Basic example

 1<nant>
 2  <!-- Omitted for brevity -->
 3  <buildArgs>-t:Help</buildArgs>
 4  <dynamicValues>
 5    <replacementValue property="buildArgs">
 6      <format>-t:{0}</format>
 7      <parameters>
 8        <namedValue name="CommandToRun" value="Help" />
 9      </parameters>
10    </replacementValue>
11  </dynamicValues>
12</nant>

Shorthand example

1<nant>
2  <!-- Omitted for brevity -->
3  <buildArgs>-t:$[CommandToRun|Help]</buildArgs>
4</nant>

Example in context

 1<project name="Test Project">
 2  <sourcecontrol type="svn">
 3    <!-- Omitted for brevity -->
 4  </sourcecontrol>
 5  <triggers>
 6    <intervalTrigger />
 7  </triggers>
 8  <tasks>
 9    <nant>
10      <!-- Omitted for brevity -->
11      <buildArgs>-t:Help</buildArgs>
12      <dynamicValues>
13        <replacementValue property="buildArgs">
14          <format>-t:{0}</format>
15          <parameters>
16            <namedValue name="CommandToRun" value="Help" />
17          </parameters>
18        </replacementValue>
19      </dynamicValues>
20    </nant>
21    <!-- Omitted for brevity -->
22  </tasks>
23  <publishers>
24    <!-- Omitted for brevity -->
25  </publishers>
26  <parameters>
27    <!-- Omitted for brevity -->
28  </parameters>
29</project>

Configuration Elements

Element Description Type Required Default Version
format The default value to use if nothing is set in the parameters. String Yes n/a 1.5
parameters The parameters to use. Named Value array Yes n/a 1.5
property The name of the property to set. String Yes n/a 1.5

Notes

The format string is any standard .NET format string that can be used with string.Format(). The parameters will be replaced in the order that they are defined in the parameters property.

Automatically Generated

Documentation generated on Monday, 26 May 2014 at 7:18:04 AM