问题
I am trying to get dynamic parameters to be used in the email publisher's subjectSettings block. For example,
<project>
...
<parameters>
<textParameter>
<name>version</name>
<display>Version to install</display>
<description>The version to install.</description>
<required>true</required>
</textParameter>
</parameters>
<tasks>
...
</tasks>
<publishers>
....
<email includeDetails="TRUE">
<from>buildmaster</from>
<mailhost>localhost</mailhost>
<users>
<user name="Joe" group="buildmaster" address="jdavies" />
</users>
<groups>
<group name="buildmaster">
<notifications>
<notificationType>Always</notificationType>
</notifications>
</group>
<group name="users">
<notifications>
<notificationType>Success</notificationType>
<notificationType>Fixed</notificationType>
</notifications>
</group>
</groups>
<subjectSettings>
<subject buildResult="Success" value="Version ${version}
installed." />
<subject buildResult="Fixed" value="Version ${version} fixed
and installed." />
</subjectSettings>
<modifierNotificationTypes>
<notificationType>Success</notificationType>
</modifierNotificationTypes>
</email>
</project>
I have tried using ${version} and $[version]. When I use $[version], the entire subject line is empty!
For example, instead of seeing at least "Version BLANK installed.", I see only an empty subject line:
[Install:INFO] Emailing "" to joe
Are dynamic parameters supported in this case, and if so, what am I doing wrong?
回答1:
Based on the comments provided, I upgraded from CC.Net 1.5.7256.1 to 1.6.7349.5. Version 1.6 seems to be working OK.
The proper format for the parameters is $[parameter], as expected.
回答2:
There is an option for "dynamicValues" (only supported in v1.5 and greater) as configuration elements.
Email Publisher Documentation
Dynamic Values Documentation
From the doucmenation (Example in context)
<project name="Test Project">
<sourcecontrol type="svn">
<!-- Omitted for brevity -->
</sourcecontrol>
<triggers>
<intervalTrigger />
</triggers>
<tasks>
<nant>
<!-- Omitted for brevity -->
<buildArgs>Help</buildArgs>
<dynamicValues>
<directValue property="buildArgs" parameter="CommandToRun" default="Help" />
</dynamicValues>
</nant>
<!-- Omitted for brevity -->
</tasks>
<publishers>
<!-- Omitted for brevity -->
</publishers>
<parameters>
<!-- Omitted for brevity -->
</parameters>
来源:https://stackoverflow.com/questions/3016911/using-dynamic-parameters-in-email-publisher-subjectsettings-block-with-cruisecon