title: Setting up NCover for NUnit in FinalBuilder
body: <p><strong>Solved: Look at the bottom of this question for the working configuration</strong></p>
  
  <hr>
  
  <p>I am attempting to set up NCover for usage in my FinalBuilder project, for a .NET 4.0 C# project, but my final coverage output file contains no coverage data.</p>
  
  <p>I am using:</p>
  
  <ul>
  <li><a href="http://www.ncover.com/" rel="nofollow noreferrer">NCover 3.3.2</a></li>
  <li><a href="http://www.nunit.org" rel="nofollow noreferrer">NUnit 2.5.4</a></li>
  <li><a href="http://www.finalbuilder.com/" rel="nofollow noreferrer">FinalBuilder 6.3.0.2004</a></li>
  </ul>
  
  <p>All tools are the latest official as of today.</p>
  
  <p>I've finally managed to coax FB into running my unit tests under NCover for the .NET 4.0 project, so I get <code>Tests run: 184, ...</code>, which is correct.</p>
  
  <p>However, the final <code>Coverage.xml</code> file output from NCover is almost empty, and looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!-- saved from NCover 3.0 Export url='http://www.ncover.com/' --&gt;
  &lt;coverage profilerVersion="3.3.2.6211" driverVersion="3.3.2" exportversion="3" viewdisplayname="" startTime="2010-04-22T08:55:33.7471316Z" measureTime="2010-04-22T08:55:35.3462915Z" projectName="" buildid="27c78ffa-c636-4002-a901-3211a0850b99" coveragenodeid="0" failed="false" satisfactorybranchthreshold="95" satisfactorycoveragethreshold="95" satisfactorycyclomaticcomplexitythreshold="20" satisfactoryfunctionthreshold="80" satisfactoryunvisitedsequencepoints="10" uiviewtype="TreeView" viewguid="C:\Dev\VS.NET\LVK.IoC\LVK.IoC.Tests\bin\Debug\Coverage.xml" viewfilterstyle="None" viewreportstyle="SequencePointCoveragePercentage" viewsortstyle="Name"&gt;
    &lt;rebasedpaths /&gt;
    &lt;filters /&gt;
    &lt;documents&gt;
      &lt;doc id="0" excluded="false" url="None" cs="" csa="00000000-0000-0000-0000-000000000000" om="0" nid="0" /&gt;
    &lt;/documents&gt;
  &lt;/coverage&gt;
  </code></pre>
  
  <p>The output in FB log is:</p>
  
  <pre><code>...
  ***************** End Program Output *****************
  
  Execution Time: 1,5992 s
  
  Coverage Xml: C:\Dev\VS.NET\LVK.IoC\LVK.IoC.Tests\bin\Debug\Coverage.xml
  NCover Success
  </code></pre>
  
  <p>My configuration of the FB step for NCover:</p>
  
  <ul>
  <li><strong>NCover what?</strong>: NUnit test coverage</li>
  <li><strong>Command</strong>: <code>C:\Program Files (x86)\NUnit 2.5.4\bin\net-2.0\nunit-console.exe</code></li>
  <li><strong>Command arguments</strong>: <code>LVK.IoC.Tests.dll /noshadow /framework:4.0.30319 /process=single /nothread</code>
  
  <ul>
  <li><em>Note: I've tried with and without the <code>/process</code> and <code>/nothread</code> options</em></li>
  </ul></li>
  <li><strong>Working directory</strong>: <code>%FBPROJECTDIR%\LVK.IoC.Tests\bin\Debug</code></li>
  <li><strong>List of assemblies to profile</strong>: <code>%FBPROJECTDIR%\LVK.IoC.Tests\bin\Debug\LVK.IoC.dll</code>
  
  <ul>
  <li><em>Note: I've tried just listing the name of the assembly, both with and without the extension.</em></li>
  </ul></li>
  </ul>
  
  <p>The documentation for the FB step doesn't help, as it only lists minor sentences for each property, and fails to give examples or troubleshooting hints.</p>
  
  <p>Since I want to pull the coverage results into NDepend to run build-time analysis, I want that file to contain the information I need.</p>
  
  <p>I am also using <a href="http://www.testdriven.net/" rel="nofollow noreferrer">TestDriven</a>, and if I right-click the solution file and select "Test with NCover", NCover-explorer opens up with coverage data, and if I ask it to show me the folder with coverage files, in there is an .xml file with the same structure as the one above, just with all the data that should be there, so the tools I have is certainly capable of producing it.</p>
  
  <p>Has anyone an idea of what I've configured wrong here?</p>
  
  <hr>
  
  <p><strong>Solved</strong>: The following configuration finally worked for me. It produces a code coverage basic statistics on the start results page for a build, with a link to a detailed report with everything.</p>
  
  <p>Since I name my unit test projects the same as the project it tests, only with a .Tests suffix, I've excluded those from the code coverage. Also, I had to specifically include only my own assemblies (which all start with LVK.) otherwise I would get some assemblies loaded by the TeamCity runner, which slightly impacted my coverage statistics.</p>
  
  <p>First, I installed latest of the tools (as of this edit):</p>
  
  <ul>
  <li>NCover 3.4.8</li>
  <li>TeamCity 5.1.2</li>
  <li>NUnit 2.5.5</li>
  </ul>
  
  <p>The configuration on the build-screen in TeamCity is then as follows:</p>
  
  <ul>
  <li>Targets: Rebuild</li>
  <li>Configuration: Debug</li>
  <li>Platform: Any CPU</li>
  <li>.NET Coverage Tool: NCover (3.x)</li>
  <li>.NET Runtime: .NET Framework 4.0, Version: Native</li>
  <li>Path to NCover 3: %system.ncover.v3.x64.path% (this is Windows 2008 Server R2 64-bit)</li>
  <li><p>Additional NCover Arguments:</p>
  
  <pre><code>//ias LVK.*
  //eas .*Tests
  //eas LVK\.CodeQuality
  //ea LVK\.CodeQuality\.IgnoreCodeCoverageAttribute
  </code></pre></li>
  <li><p>Additional NCover Reporting Arguments:</p>
  
  <pre><code>//or FullCoverageReport:Html:{teamcity.report.path}
  </code></pre></li>
  <li><p>NUnit Runner: NUnit 2.5.5</p></li>
  <li>.NET Runtime Platform: auto (MSIL), Version: 4.0</li>
  <li>Run tests from: **\bin\Debug*Tests.dll</li>
  </ul>