问题
I'm trying to integrate PartCover.NET with NAnt and CruiseControl.NET I can run PartCover.NET browser without problems, but it does not work once I try to run it in an NAnt task (in my CCNET build).
There must be an issue with my NAnt target but I can't find it. Maybe someone had experienced the same issues in the past?.
<target name="CoverageUnitTest" description="Code coverage of unit tests">
<exec program="${PartCover.exe}">
<arg value="--target=${NUnit.console}" />
<arg value="--target-work-dir=${project.dir}\bin\${configuration}"/>
<arg value="--target-args=${project}.dll" />
<arg value="--output=C:\partcover.xml" />
<arg value="--include=[*]*" />
</exec>
</target>
In CruiseControl, I got the following error message: [exec] Invalid option '--target C:\NUnit\bin\nunit-console.exe'
Build Error: NAnt.Core.BuildException
External Program Failed: C:\PartCover\PartCover.exe (return code was -1)
in C:\default.build line: 20 col: 4
at NAnt.Core.Tasks.ExternalProgramBase.ExecuteTask()
at NAnt.Core.Tasks.ExecTask.ExecuteTask()
at NAnt.Core.Task.Execute()
at NAnt.Core.Target.Execute()
at NAnt.Core.Project.Execute(String targetName, Boolean forceDependencies)
at NAnt.Core.Project.Execute()
at NAnt.Core.Project.Run()
thanks ! David
回答1:
Replace = with space and use the " ; marker around the parameters for the arguments
回答2:
As You may have noticed this task is rather complicated. It drove me to the edge of insanity but at last I got it running.
Here is some general advice:
use PartCover version 2.2 instead of 2.3 since the latter is a dev version that seems to be unstable.
remember to register PartCover.CorDriver.dll.
passing arguments is the hardest part if You need to quote paths. I finally decided to use a configuration file and pass it via
--settings
.
来源:https://stackoverflow.com/questions/1210009/integrating-partcover-net-with-nant