Integrating PartCover.NET with NAnt

妖精的绣舞 提交于 2020-01-02 07:10:10

问题


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 &quot ; 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!