When calling external processes like MSBuild cruise control sets environment variables. One of values is CCNetLabel. it holds the value of the current projects label. I want to use the same values in ccnet config itself but when I try ccnet config has a problem. I get the following error:
[CCNet Server:ERROR] INTERNAL ERROR: Reference to unknown symbol CCNetLabel
----------
ThoughtWorks.CruiseControl.Core.Config.Preprocessor.EvaluationException: Reference to unknown symbol CCNetLabel
at ThoughtWorks.CruiseControl.Core.Config.Preprocessor.ConfigPreprocessorEnvironment._GetConstantDef(String name)
at ThoughtWorks.CruiseControl.Core.Config.Preprocessor.ConfigPreprocessorEnvironment.eval_text_constant(String name)
.....
----------
I actually want to append the CCNetLabel to another variable so I need to access the property in ccnet.config.
is there a different way to reference these variables?
We had a need to do this too, and found that we could use Replacement Dynamic Values, introduced in CruiseControl.NET 1.5, to access the CCNetLabel from within ccnet.config.
For example, the dynamicValues block in this snippet:
<buildpublisher>
<sourceDir>C:\ccnet_projects\Installer\bin\x86\Release</sourceDir>
<dynamicValues>
<replacementValue property="publishDir">
<format>C:\builds\installers\{0}\x86</format>
<parameters>
<namedValue name="$CCNetLabel" value="Default" />
</parameters>
</replacementValue>
</dynamicValues>
<useLabelSubDirectory>false</useLabelSubDirectory>
</buildpublisher>
Produces a publishDir path containing the CCNetLabel value on the fly:
<buildpublisher>
<sourceDir>C:\ccnet_projects\Installer\bin\x86\Release</sourceDir>
<publishDir>C:\builds\installers\1.0.2.120\x86</publishDir>
<useLabelSubDirectory>false</useLabelSubDirectory>
</buildpublisher>
(Note that for this particular example, useLabelSubDirectory is set to false to avoid appending the CCNetLabel to the publishDir path.)
The following can be used in config file in ccnet version 1.5 < cb:define buildversion="$[$CCNetLabel]" />
I think Darryl's answer is the best approach to solve this problem in CCNET 1.5. Just two comments about the answer:
$[$Integration_Property]
. In your case, using $[$CCNetLabel]
would work.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With