3

如何在文件合并任务中使用 CCNetLabel?根据我的发现,我必须使用 dynamicValues。我有这样的东西,它没有任何帮助?

<publishers>
  <merge>
    <dynamicValues>
      <replacementValue property="files">
        <format>D:\Testoutput\{0}\*.xml</format>
        <parameters>
          <namedValue name="$CCNetLabel" value="Default" />
        </parameters>
      </replacementValue>
    </dynamicValues>
  </merge>
  <xmllogger />
  <modificationHistory onlyLogWhenChangesFound="true" />
  <statistics />
</publishers>
4

1 回答 1

3

在您的脚本中,您尝试生成以下配置(我故意使用更易于阅读的速记符号):

<publishers>
  <merge>
    <files>D:\Testoutput\$[$CCNetLabel]\*.xml</files>
  </merge>
  <xmllogger />
  <modificationHistory onlyLogWhenChangesFound="true" />
  <statistics />
</publishers>

这不起作用,因为<files>它是一个数组,因此您需要类似的东西:

<publishers>
  <merge>
    <files>
      <file>D:\Testoutput\$[$CCNetLabel]\*.xml</file>
    </files>
  </merge>
  <xmllogger />
  <modificationHistory onlyLogWhenChangesFound="true" />
  <statistics />
</publishers>

不幸的是,这也不起作用,因为<dynamicValues>仅支持标签<merge>但不支持<files>标签。我认为目前(1.6 版)根本无法在此处使用集成属性。

我将使用以下解决方法来实现相同的结果:

<publishers>
  <exec>
    <executable>C:\Windows\system32\cmd.exe</executable>
    <buildArgs>/C copy D:\Testoutput\$[$CCNetLabel]\*.xml D:\Testoutput\FixedDir</buildArgs>
  </exec>
  <merge>
    <files>
      <file>D:\Testoutput\FixedDir\*.xml</file>
    </files>
  </merge>
  <xmllogger />
  <modificationHistory onlyLogWhenChangesFound="true" />
  <statistics />
  <exec>
    <executable>C:\Windows\system32\cmd.exe</executable>
    <buildArgs>/C del D:\Testoutput\FixedDir\*.xml</buildArgs>
  </exec>
</publishers>
于 2011-02-05T16:31:04.357 回答