chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
For our projects we don't typically install the tools that are used for various purposes, such as nant, nunit, ncover, fxcop, etc.

As such, when trying to run our code coverage nant target that uses NCover I'm unable to get it to run. I know about <typemockstart link="NCover"/> but doing that only results in a different error, an obvious one (listed below):

[typemockstart] Profiler: NCover is not recognized or not installed on your machine
[typemockstart] There are no recognized profilers


Is there any way to get this to work w/out having to install NCover on our buildserver?
asked by kyleheon (3.1k points)

9 Answers

0 votes
Kyle hi,

Currently TypeMock can link only with an installed version of NCover. :(

However, we have been contemplating adding this ability as part of TypeMock AutoDeploy feature. I will pass on your request so it will be added to a future release.

Thank you for the report and sorry I couldn't help you more.
answered by lior (13.2k points)
0 votes
Lior, correct me if I am wrong, but doesn't Grant Drake cover this issue in his NCover Problems/Fixes Part 1 article? He gives you some options on how to solve it. I prefer using the MSBuild/NAnt task included in the NCoverExplorer.Extras as it gives me the option of registering the profiler when running the task.

HTH

Carel
answered by cjlotz (3k points)
0 votes
Carel hi

Thank you for the pointer.
It seems that indeed Grant Drake cover this issue. :D
We will check it out and post a solution.
answered by lior (13.2k points)
0 votes
Any progress with this solution? Just curious as the thread has been quite.
answered by kyleheon (3.1k points)
0 votes
Nevermind. I re-read the article linked to on the Kiwidude site and I think I have things closer to working. If you add registerProfiler="false" to his NCover NAnt/MSBuild task it seems to work.

I'm now getting an error w/the NCoverExplorer task but that's a different story entirely.

Here is my code coverage target for reference:

<target name="code-coverage" description="Generates a code coverage report">
   <typemockstart link="NCover"/>
   <ncover
         registerProfiler="false"
         program="${path.ncover.console}"
         commandLineExe="${path.nunit.console}"
         commandLineArgs="NationalFinancial.BAC.Tests.Unit.dll /labels /nologo"
         workingDirectory="${source.dir}Tests.Unitin${configuration}"
         logFile="${reporting.dir}NCover.log"
         coverageFile="${reporting.dir}${coverage.xml}">
      <assemblies basedir="${source.dir}Corein${configuration}">
         <include name="NationalFinancial.BAC.Core.dll"/>
      </assemblies>
   </ncover>

   <ncoverexplorer
      program="${path.ncoverexplorer.console}"
      projectName="${project.name}"
      outputDir="${reporting.dir}"
      reportType="4"
      satisfactoryCoverage="80"
      xmlReportName="CoverageSummary.xml">
      <fileset>
         <include name="${reporting.dir}${coverage.xml}" />
      </fileset>
   </ncoverexplorer>
   <typemockstop/>
</target>


This was all tested locally, need to deploy to my build server and test but all signs point to yes.
answered by kyleheon (3.1k points)
0 votes
Hi,
Sorry for the short delay but we had to verify that its working.
I've tested one of the solutions pointed in the article, and it seems to be working for me too.
I've added to our build files manual registration&unregistration using "regsvr32" command.
it should go something like this:
<Target Name="TestCLR20" >
<Exec ContinueOnError="true" Command='regsvr32 /s "FULLPATH TO CoverLib.dll" />
<TypeMockStart Link ="NCover" Target="2.0" />

... your test commands...

<Exec ContinueOnError="true" Command='regsvr32 /s /u "FULLPATH TO CoverLib.dll" />
</Target>


This will cause the NCover to register before TypeMock linking process and unregister at the end of the tests. I've verified this is working on a machine without NCover installed.
The main point is that in order for TypeMock to link with NCover, it needs to find that dll in the registry. So I guess that any other mechanism for achieving it will work as well.
answered by lior (13.2k points)
0 votes
Finally achieved success on our build server. Taking from what was provided above by lior, I was able to get this working via a nant script:

<target name="code-coverage" description="Generates a code coverage report">
   <exec program="regsvr32">
      <arg value="/s" />
      <arg value="${tools.dir}
coverCoverLib.dll" />
   </exec>

   <typemockstart link="NCover" target="2.0" />
   <ncover
      registerProfiler="false"
      program="${path.ncover.console}"
      commandLineExe="${path.nunit.console}"
      commandLineArgs="NationalFinancial.BAC.Tests.Unit.dll /labels /nologo"
      workingDirectory="${source.dir}Tests.Unitin${configuration}"
      logFile="${reporting.dir}NCover.log"
      coverageFile="${reporting.dir}${coverage.xml}">
      <assemblies basedir="${source.dir}Corein${configuration}">
         <include name="NationalFinancial.BAC.Core.dll"/>
      </assemblies>
   </ncover>
   <typemockstop/>

   <ncoverexplorer
      program="${path.ncoverexplorer.console}"
      projectName="${project.name}"
      outputDir="${reporting.dir}"
      reportType="4"
      satisfactoryCoverage="80"
      xmlReportName="CoverageSummary.xml">
      <fileset>
         <include name="${reporting.dir}${coverage.xml}" />
      </fileset>
   </ncoverexplorer>

   <exec program="regsvr32">
      <arg value="/u" />
      <arg value="/s" />
      <arg value="${tools.dir}
coverCoverLib.dll" />
   </exec>
</target>


Many thanks to everyone who pitched in to get a solution. Impressive customer service. Thanks a ton.
answered by kyleheon (3.1k points)
0 votes
Thank you
But the credit for this should go to Carel.
She was the one pointing us in the right direction

Thank you Carel.
answered by lior (13.2k points)
0 votes
Yes indeed. Thank you Carel.
answered by kyleheon (3.1k points)
...