teamcitycode-coveragencovercorflags

NCover on 64 bit - CorFlags fix - corflags : error CF008 : The specified file does not have a valid managed header


I'm trying to apply a fix to allow NCover v1.5.5 to run on Windows Server 2008 X64 via my TeamCity Continuous Integration server as outlined on this blog:

http://abdullin.com/journal/2008/6/6/how-to-run-free-ncover-on-a-64-bit-machine.html

Here is my log:

[09:47:04]: run-unit-tests:
[09:47:04]: [echo] Running NCover: tools\ncover\NCover.Console.exe with workingdir='build\Debug\UnitTests'
[09:47:04]: [exec] NCover.Console v1.5.5 - Code Coverage Analysis for .NET - http://ncover.org
[09:47:04]: [exec] Copyright (c) 2004-2005 Peter Waldschmidt
[09:47:04]: [exec]
[09:47:04]: [exec]
[09:47:04]: [exec] Command: ..\..\..\tools\nunit\nunit-console.exe
[09:47:04]: [exec] Command Args: "UnitTests.dll" "/xml:..\..\test-reports\UnitTests.xml" "/nologo"
[09:47:04]: [exec] Working Directory: .
[09:47:04]: [exec] Assemblies:
[09:47:04]: [exec] Coverage Xml: D:\TeamCity\buildAgent\work\a65ff8d0771db303\build\test-reports\Coverage.xml
[09:47:04]: [exec] Coverage Log: Coverage.Log
[09:47:04]: [exec]
[09:47:07]: [exec] Waiting for profiled application to connect.......N.N.N.N..N.......
[09:47:07]: [exec] Tests run: 11, Failures: 0, Not run: 5, Time: 1.096 seconds
[09:47:07]: [exec]

[09:47:07]: [exec]
[09:48:04]: [exec] Connected
[09:48:04]: [exec] **Profiled process terminated. Profiler connection not established.**
[09:48:04]: BUILD FAILED

So I'm trying to apply the CorFlags trick to make it work, but I am getting an error:

C:\Program Files (x86)\Microsoft.NET\SDK\v2.0\Bin>CorFlags.exe D:\TeamCity\build Agent\work\a65ff8d0771db303\tools\NCover\NCover.exe /32BIT+

Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved.

corflags : error CF008 : The specified file does not have a valid managed header

Any ideas?? Help!


Solution

  • I actually solved this by upgrading to a newer version of NUnit, and changing my NCover task to point to the X86 version:

        <exec program="tools\ncover\NCover.Console.exe" workingdir="${build.dir}\Debug\UnitTests">
            <arg value="//w &quot;.&quot;" />
            <arg value="//x &quot;..\..\test-reports\Coverage.xml&quot;" />
            <arg value="&quot;..\..\..\lib\NUnit-2.4.8-net-2.0\bin\nunit-console-x86.exe&quot;" />
            <arg value="&quot;UnitTests.dll&quot; &quot;/xml:..\..\test-reports\UnitTests.xml&quot; &quot;/nologo&quot;" />
        </exec>