CruiseControl.NET: using $(CCNetLabel ) inside ccnet.config file

Viewed 23444

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?

8 Answers

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:

  • This is the right link to ccnet docs about Dynamic Parameters.
  • As you can read in the docs, there is a shortcut to obtain just the value of the integration property you are looking for using the syntax $[$Integration_Property]. In your case, using $[$CCNetLabel] would work.

I've solved this by adding an msbuild task in the publisher section (including the CCNetLabel in the path)

<msbuild>
    <executable>c:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>
    <workingDirectory>C:\Path\WebApp</workingDirectory>
    <projectFile>WebApp.csproj</projectFile>
    <dynamicValues>
        <replacementValue property="buildArgs">
            <format>/noconsolelogger /v:quiet /p:Configuration=Release /p:WebProjectOutputDir=c:\Publish\WebApp\{0}\ /p:OutDir=c:\Publish\WebApp\{0}\bin\</format>
            <parameters>
                <namedValue name="$CCNetLabel" value="Default" />
            </parameters>
        </replacementValue>
    </dynamicValues>                    
    <targets>ResolveReferences;_CopyWebApplication</targets>
    <timeout>600</timeout>              
</msbuild>
Related