title: How do I run OpenCover + NUnit in TeamCity without running all unit tests twice?
body: <p>I set up OpenCover in my MSBuild script, setup the ReportGenerator, and have it output as an artifact and have a custom tab - all of that works great. Here is my MSBuild target:</p>
  
  <pre><code>&lt;Target Name="Test"&gt;
  
          &lt;!-- Check Code Coverage --&gt;
          &lt;Exec Command="..\..\tools\OpenCover.4.0.519\OpenCover.Console.exe -register:user -target:..\..\tools\NUnit\nunit-console.exe -targetargs:&amp;quot;$(TestAssemblies) /xml=NUnitReport.xml /noshadow&amp;quot; -filter:&amp;quot;+[HelloWorld.Mvc3UI*]* -[HelloWorld.Mvc3UI.UnitTests*]*&amp;quot; -output:OpenCoverReport.xml"&gt;&lt;/Exec&gt;
  
          &lt;!-- Format Code Coverage Report --&gt;
          &lt;Exec Command="..\..\tools\ReportGenerator.1.5.0.0\ReportGenerator.exe OpenCoverReport.xml OpenCoverReport"&gt;&lt;/Exec&gt;
  
  &lt;/Target&gt;
  </code></pre>
  
  <p>However, in order to run OpenCover it attaches to the NUnit runner to produce the report, which in turn runs all of the unit tests. While this can produce an xml output for the unit tests, I have yet to find an xsl file to produce reports as good as the ones built into TeamCity 7.1, much less the filtering and searching capabilities.</p>
  
  <p>But if I enable the reports in TeamCity using the built-in NUnit runner (aparently the only way to get the unit test report in TeamCity), it re-runs the unit tests to generate its report.</p>
  
  <p>While all this works, my question is whether there is a way to get both reports without having to run all of the unit tests twice? Specifically, can OpenCover generate its report without running the NUnit tests or can TeamCity generate its report without running the unit tests?</p>
  
  <p>Note that this is an ASP.NET MVC3 application, and the OpenCover documentation doesn't specify how to attach ASP.NET or whether it is even possible, but it is pretty clear it requires an executable to attach to. Note also I am using NUnit 2.6.1 in case that matters.</p>