MSBuild - not a valid Win32 application

MSBuild - not a valid Win32 application

[First time NCover user]

I was able to generate coverage for my project using NCoverExplorer as well as the command-line too, but when I try to use the MSBuild task, I get an error:

-- Top-level exception (NCover.Utilities.Exceptions.ProfilerRuntimeException) The process could not be started. Ensure that it runs outside of NCover. -- Stack Trace at NCover.Framework.StartupProfiledProcess._StartProcess() at NCover.Framework.StartupProfiledProcess.Start() at NCover.Framework.ProfilerDriver.ExecuteNCover(Int32& profiledAppCode) at NCover.Framework.ProfilerDriver.Execute(Int32& profiledAppCode) at NCover.ConsoleMain.ConsoleMain.Main(String[] args) -- Inner exceptions The specified executable is not a valid Win32 application.

:\Build\Current\Build\webmd.msbuild(541,7): error MSB6006: "NCover.Console.exe" exited with code 20000.

I found the temporary ncoversettings file that ncover creates but it is always empty.

Here's my msbuild task (generated form the ncoverexplorer):

  <NCover ToolPath="C:\Build\Current\Tools\NCover"

CommandLineExe="C:\Build\Current\Tools\NUnit\bin\nunit-console.exe" CommandLineArgs="C:\BuildOutput\Current\HealthQuotient\Tests\Debug\bin\WebMD.UnitTests.HealthQuotient.dll" WorkingDirectory="C:\BuildOutput\Current\working" CoverageFile="C:\BuildOutput\Current\coverage\coverage.xml" AppendTrend="C:\BuildOutput\Current\coverage\history\coverage.trend" RegisterProfiler="True" ProjectName="MyProject" CoverageHtmlDirectory="C:\BuildOutput\Current\coverage" CoverageType="Symbol, Branch, CyclomaticComplexity, MethodVisits" LogFile="C:\BuildOutput\Current\coverage\logs\coverage.log" LogLevel="Normal" />

Help please!

Thanks,

Kevin


RE: MSBuild - not a valid Win32 application

I am using the 3.0 beta BTW.


RE: MSBuild - not a valid Win32 application

are you using the x64 edition?


RE: MSBuild - not a valid Win32 application

I am using x86 version and am getting the same problem when i run the ncover console command from MSBuild script. Is there any solution available


RE: MSBuild - not a valid Win32 application

could you post the ncover portion of the msbuild script you are using?


RE: MSBuild - not a valid Win32 application

I am also trying to do this using the 3.0 beta and I am getting a similar error. Here is the stack trace:

Command: "C:\Users\eric.hauser\AppData\Local\Temp\2\tmp4C1D.tmp.ncoversetting s" Command Args: Working Directory: Assemblies: (All Loaded Assemblies)

Program Output

Exception

-- Top-level exception (NCover.Utilities.Exceptions.ProfilerRuntimeException) The process could not be started. Ensure that it runs outside of NCover. -- Stack Trace at NCover.Framework.StartupProfiledProcess._StartProcess() at NCover.Framework.StartupProfiledProcess.Start() at NCover.Framework.ProfilerDriver.ExecuteNCover(Int32& profiledAppCode) at NCover.Framework.ProfilerDriver.Execute(Int32& profiledAppCode) at NCover.ConsoleMain.ConsoleMain.Main(String[] args)

And here is the relevant section from the MSBuild file:

<Target Name="RunUnitTests">
    <NCover
        ToolPath="C:\Program Files\NCover\"
        CommandLineExe="C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe"
        CommandLineArgs="ANY MSIL NUnit-2.4.7 /category-exclude:Integration build\net-3.5\debug\Company.UnitTest.dll"
        CoverageFile="build\net-3.5\debug\coverage\release_test_results.xml"
    />
</Target>   

This is using the x86 version.


RE: MSBuild - not a valid Win32 application

looks like the task is calling NCover incorrectly. We are currently revamping all of the build tasks, and will explicitly check for this bug during that process. Unfortunatly, we do not expect a new beta release until early January. Until then, please use the executable task.


RE: MSBuild - not a valid Win32 application

Hi,

I am trying again with the latest beta (3.0.9). The NCover task works OK now but the new NCoverReporting task is not working for me. It prints out a 'Usage' statement but does not generate a report.

The temp file that it refers to does not exist but there are a bunch of other zero length temp files (presumably from the NCover taks that ran just before it.

Should I expect this to work, or are the build tasks not yet fully baked?

Thanks,

Kevin

I am running 32 bit on windows server 2003.

My build task:

  <NCoverReporting ProjectName="Project - $(ModuleName)"
                   ToolPath="$(SourceDirectoryPath)\Tools\NCover"
                   CoverageDataPaths="$(CoverageDir)\*.xml"
                   MaxTopUncoveredToReport="10"
                   OutputPath="$(TestResultsDir)"
                   ReportFormat="Xml"
/>

And the task output:

NCover.Reporting v3.0.9 (Administrator x86)

Merging and Reporting for NCover Copyright (c) 2008 Gnoso Inc. http://www.ncover.com

Arguments: "C:\Build\Current\Build..\Tools\NCover\NCover.Reporting.exe" //cr "C:\Documents and Settings\klawrence\Local Settings\Temp\1\tmp518.tmp"

NCover.Reporting [inputfiles] [options] Processes a set of NCover coverage xml files from the console. Intended for usage in automated builds. Options: //at[appendTrend] Append trend data from merged coverage files to the given file.

//cr[configRead]


RE: MSBuild - not a valid Win32 application

Update:

I added the report type attribute and got further (note that the examples in the Tasks directory don't include this attribute).

It dies now with:

Appended trend data to 'C:\buildoutput\Current\CoverageTrends\Common.trend'

-- Top-level exception (System.ApplicationException) Unable to rename trend file. -- Stack Trace at NCover.Framework.Models.Trends.TrendCoverageData.AppendToFile(ICoverageView view, String path, ICoverageReportSettings sett ings, Boolean forReport) at NCover.Framework.Reports.ReportingProcessor.Process() at NCover.Reporting.ReportMain.Main(String[] args) -- Inner exceptions Cannot create a file when that file already exists.

-- Stack Trace at System.IO.Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.Error.WinIOError() at System.IO.File.Move(String sourceFileName, String destFileName) at NCover.Framework.Models.Trends.TrendCoverageData.AppendToFile(ICoverageView view, String path, ICoverageReportSettings sett ings, Boolean forReport)


RE: MSBuild - not a valid Win32 application

Update #2:

My OutputPath attribute was pointing to a directory. When I gave it a file name, the NCoverReport task succeeds with no errors.

Not sure what the error about the trend reports (in my previous post) was about.

Now trying to figure out how to get the report to show up in CC.Net.

Almost there (I hope).

Kevin


RE: MSBuild - not a valid Win32 application

If you need any additional help, feel free to contact us.

Joe


RE: MSBuild - not a valid Win32 application

Thanks Joe,

It got it all working now and I am very happy with the results - but I've gotta say that the Reporting task doesn't give much help when you configure it wrong and most of the examples in the MSBuild Tasks file are incomplete.

I understand it's beta so I am not complaining - just pointing out that it needs some work.

Kevin


RE: MSBuild - not a valid Win32 application

I am working on the documentation as we speak. It should be out with the site release over the next day or so.

Thanks

Joe


RE: MSBuild - not a valid Win32 application

Joe

Do you have a link to the documentation?

I am also fighting with this with Team City and get an empty coverage.xml file!


RE: MSBuild - not a valid Win32 application

we are still working on the documentation. If you could explain the particular problem you're running into, I'll be more than happy to help you.


RE: MSBuild - not a valid Win32 application

Good to hear that. Please keep us posted. Thanks