views:

47

answers:

1

I'm trying to use the CCNetBuildDate and CCNetBuildTime parameters to dynamically change the output filename of my unit test results, so for example:

<project>
       <workingDirectory>C:\MyProject</workingDirectory>
  <tasks>
    <msbuild>
      <buildArgs>/property:TestResultsFile=TestResults.$[CCNetBuildDate].$[CCNetBuildTime].trx</buildArgs>
      <!-- etc... -->
    </msbuild>
  </tasks>

  <publishers>
    <merge>
      <files>
        <file>TestResults.$[CCNetBuildDate].$[CCNetBuildTime].trx</file>
      </files>
    </merge>
    <xmllogger />
  </publishers>
</project>

The trouble is that I cant figure out the syntax for using parameters in this way - I've tried dozens of variations:

  • $(CCNetBuildTime)
  • ${CCNetBuildTime}
  • $CCNetBuildTime

But it never seems to actually pass the build time as the parameter (so for example in the above case I ended up with a filename "TestResults.$[CCNetBuildDate].$[CCNetBuildTime].trx"

What am I doing wrong?

(FYI: The reason I'm trying to dynamically decide the test results filename is because with a fixed results filename I kept on having the results from past builds included in my build report)

+1  A: 

Short: You can't access integration properties like CCNetBuildDate inside your CCNET configuration.

Find my answers on similar questions: Here, here, and here.

Since the same question arises again and again, it seems to be absolutely intuitive to use the integration properties this way. So it perhaps would be worth making it a CCNET feature request...

The Chairman