<p>I'm trying to setup CruiseControl.net at the moment. So far it works nice, but I have a Problem with the MSBuild Task.</p>

<p>According to the <a href="http://confluence.public.thoughtworks.org/display/CCNET/MsBuild+Task" rel="noreferrer">Documentation</a>, it passes CCNetArtifactDirectory to MSBuild. But how do I use it?</p>

<p>I tried this:</p>

<pre><code>&lt;buildArgs&gt;
   /noconsolelogger /p:OutputPath=$(CCNetArtifactDirectory)\test
&lt;/buildArgs&gt;
</code></pre>

<p>But that does not work. In fact, it kills the service with this error:</p>

<blockquote>
  <p>ThoughtWorks.CruiseControl.Core.Config.Preprocessor.EvaluationException: Reference to unknown symbol CCNetArtifactDirectory</p>
</blockquote>

<p>Documentation is rather sparse, and google und mainly offers modifying the .sln Project file, which is what I want to avoid in order to be able to manually build this project later - I would really prefer <code>/p:OutputPath</code>.</p>

[{'answer_id': 1023, 'author': 'FryHard', 'author_id': 231, 'author_profile': 'https://Stackoverflow.com/users/231', 'pm_score': 4, 'selected': True, 'text': '<p>The CCNetArtifactDirectory is passed to the MSBuild by default, so you dont need to worry about it. MSBuild will place the build output in the "bin location" relevant to the working directory that you have specified.</p>\n\n<pre><code>&lt;executable&gt;c:\\WINDOWS\\Microsoft.NET\\Framework\\v3.5\\MSBuild.exe&lt;/executable&gt;\n&lt;workingDirectory&gt;C:\\data\\projects\\FooSolution\\&lt;/workingDirectory&gt;\n&lt;projectFile&gt;FooSolution.sln&lt;/projectFile&gt;\n&lt;buildArgs&gt;/noconsolelogger /p:Configuration=Debug &lt;/buildArgs&gt;\n</code></pre>\n\n<p>So in the above example your build output will be put in C:\\data\\projects\\FooSolution[ProjectName]\\bin\\Debug. Should you want to output to a different location you may want to look at of the  tag in CCNET.</p>\n\n<pre><code>&lt;publishers&gt;\n  &lt;xmllogger /&gt;\n  &lt;buildpublisher&gt;\n    &lt;sourceDir&gt;C:\\data\\projects\\FooSolution\\FooProject\\bin\\Debug&lt;/sourceDir&gt;\n    &lt;publishDir&gt;C:\\published\\FooSolution\\&lt;/publishDir&gt;\n    &lt;useLabelSubDirectory&gt;false&lt;/useLabelSubDirectory&gt;\n  &lt;/buildpublisher&gt;\n&lt;/publishers&gt;\n</code></pre>\n\n<p>This will allow you to publish your output to a different location.</p>\n'}, {'answer_id': 1281, 'author': 'Greg Hurlman', 'author_id': 35, 'author_profile': 'https://Stackoverflow.com/users/35', 'pm_score': 3, 'selected': False, 'text': '<p>You can use the artifact directory variable inside the MSBuild script itself.  Here\'s an example of how I\'m running FxCop right now from my CC.Net MSBuild script (this script is what CC.Net points to - there is also a "Build" target in the script that includes an MSBuild task against the SLN to do the actual compilation):</p>\n\n<pre><code>&lt;Exec\n  Command=\'FxCopCmd.exe /project:"$(MSBuildProjectDirectory)\\FXCopRules.FxCop" /out:"$(CCNetArtifactDirectory)\\ProjectName.FxCop.xml"\'\n  WorkingDirectory="C:\\Program Files\\Microsoft FxCop 1.35"\n  ContinueOnError="true"\n  IgnoreExitCode="true"\n/&gt;\n</code></pre>\n'}, {'answer_id': 2343524, 'author': 'The Chairman', 'author_id': 38029, 'author_profile': 'https://Stackoverflow.com/users/38029', 'pm_score': 2, 'selected': False, 'text': '<p>Parameters like <code>CCNetArtifactDirectory</code> are passed to external programs using environment variables. They are available in the external program but they aren\'t inside <code>CCNET</code> configuration. This often leads to confusion.</p>\n\n<p>You can use a preprocessor constant instead: </p>\n\n<pre><code>&lt;cb:define project.artifactDirectory="C:\\foo"&gt;\n&lt;project&gt;\n  &lt;!-- [...] --&gt;\n  &lt;artifactDirectory&gt;$(project.artifactDirectory)&lt;/artifactDirectory&gt;\n  &lt;!-- [...] --&gt;\n  &lt;tasks&gt;\n    &lt;!-- [...] --&gt;\n    &lt;msbuild&gt;\n      &lt;!-- [...] --&gt;\n      &lt;buildArgs&gt;/noconsolelogger /p:OutputPath=$(project.artifactDirectory)\\test&lt;/buildArgs&gt;\n      &lt;!-- [...] --&gt;\n    &lt;/msbuild&gt;\n    &lt;!-- [...] --&gt;\n  &lt;/tasks&gt;\n  &lt;!-- [...] --&gt;\n&lt;/project&gt;\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/835', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/91/']