2010-06-10 41 views
1

我正在嘗試獲取發件人的subjectSettings塊中的電子郵件 中使用的動態參數。例如,在CruiseControl.Net中使用電子郵件發佈者subjectSettings塊中的動態參數

<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> 

我試過使用$ {version}和$ [version]。當我使用$ [版本], 整個主題行是空的!

例如,而不是看到「安裝版本BLANK」至少,我看到的只是一個空主題行:

[Install:INFO] Emailing "" to joe 

在這種情況下支持動態參數,如果是這樣,我是什麼 做錯了?

+0

您使用的是什麼版本的CC.Net? – 2010-06-10 17:34:56

+0

我正在使用版本1.5.7256.1。 – Armbrat 2010-06-10 17:38:15

+0

您的參數塊沒有默認值。如果您輸入了默認值,您的電子郵件是否至少包含該主題中的默認值? – 2010-06-10 18:31:03

回答

1

根據所提供的註釋,我升級從CC.Net 1.5.7256.1到1.6.7349.5 。版本1.6似乎工作正常。

正如預期的那樣,參數的正確格式是$ [parameter]。

0

「dynamicValues」(僅在v1.5及更高版本中受支持)作爲配置元素有一個選項。

Email Publisher Documentation
Dynamic Values Documentation

從doucmenation(在上下文中實施例)

<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> 

+0

尼克 - 我將如何將動態值數組與動態參數塊結合使用? – Armbrat 2010-06-10 18:04:33

相關問題