Troubleshooting the CCNetArtifactDirectory
Issue in CruiseControl.net
Setting up an automated build system can be tricky, especially when dealing with platform-specific configurations. One common challenge developers face is integrating CruiseControl.net
with the MSBuild
task. This blog post aims to clarify how to use CCNetArtifactDirectory
effectively, ensuring that your build outputs are managed correctly without unnecessary modifications to project files.
Understanding the Problem
You might have encountered an issue while setting up CruiseControl.net involving the MSBuild
task configuration. The main question here is:
How do I effectively utilize the
CCNetArtifactDirectory
within MSBuild without causing errors in my build process?
The confusion arises because even though CCNetArtifactDirectory
is supposed to be passed to MSBuild automatically, many users find that they cannot reference it correctly in their build arguments. A common error you might see is:
ThoughtWorks.CruiseControl.Core.Config.Preprocessor.EvaluationException: Reference to unknown symbol CCNetArtifactDirectory
Let’s dive into a solution.
The Solution
Don’t Worry About CCNetArtifactDirectory
The good news is that you don’t have to directly specify CCNetArtifactDirectory
in your MSBuild commands. By default, CruiseControl.net passes this directory to MSBuild, which takes care of placing the build output in the appropriate location based on the working directory specified in your configuration.
Here’s an example configuration:
<executable>c:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
<workingDirectory>C:\data\projects\FooSolution\</workingDirectory>
<projectFile>FooSolution.sln</projectFile>
<buildArgs>/noconsolelogger /p:Configuration=Debug</buildArgs>
Output Location
Using the above configuration, the output from your builds will be directed to:
C:\data\projects\FooSolution\[ProjectName]\bin\Debug
This means that the artifacts are being generated correctly without you having to worry about specifying CCNetArtifactDirectory
.
Customizing Output Location
However, if you desire to direct your output to a different location, you can achieve this through the <publishers>
section of your CruiseControl.net configuration.
Here’s how to customize the output directory:
<publishers>
<xmllogger />
<buildpublisher>
<sourceDir>C:\data\projects\FooSolution\FooProject\bin\Debug</sourceDir>
<publishDir>C:\published\FooSolution\</publishDir>
<useLabelSubDirectory>false</useLabelSubDirectory>
</buildpublisher>
</publishers>
In this sample configuration:
sourceDir
: Specify the directory from where MSBuild will publish the artifacts.publishDir
: Set the destination where you want to publish the build outputs.useLabelSubDirectory
: This option can be toggled to include or exclude label directories in your publish path.
Summary
Integrating CruiseControl.net with MSBuild doesn’t have to be a daunting task. By recognizing that you don’t need to directly reference CCNetArtifactDirectory
, you can streamline your build process effectively. If you ever need to redirect build outputs, simply configure the <publishers>
section accordingly.
With these solutions at hand, you’ll be better equipped to handle your automated build configurations seamlessly.
This concludes our overview of dealing with CCNetArtifactDirectory
issues in CruiseControl.net when using MSBuild. Embrace this knowledge to enhance your workflow and make your development experience smoother!