OpenCover:无法 运行 覆盖超过 2 个程序集

OpenCover: Unable to run coverage for more than 2 assemblies

我正在尝试将 OpenCover 与 XUnit 和 MSBuild 一起用于我们的项目,它可以很好地处理一个或两个程序集。但是当程序集的数量超过 2 时,它会抛出以下错误:

    EXEC : error : unknown command line option: MyProj.UnitTest.dll
    [C:\CMR\Source\trunk\Build\Script\CMR.msbuild]
    Committing...
    No results, this could be for a number of reasons. The most common reasons are:
    1) missing PDBs for the assemblies that match the filter please review the output 
        file and refer to the Usage guide (Usage.rtf) about filters.
    2) the profiler may not be registered correctly, 
    please refer to the Usage guide and the -register switch.

我认为问题出在我添加的第 3 个组件上,所以 运行 它再次单独运行时运行良好。以下是我使用的脚本:

<Exec Command='$(OpenCoverPath)\OpenCover.Console.exe "-target: $(XUnitPath)\xunit.console.exe" "-targetargs:C:\MyPath\UnitTest1.dll C:\MyPath\UnitTest2.dll C:\MyPath\UnitTest3.dll /noshadow" "-output:c:\OpenCoverReport\coverage.xml"'/>

这是我的假设,为了在这里发布,我将 dll 的路径设置为 C:\MyPath\UnitTest.dll 但实际上路径是如此之大,并且有多个程序集具有巨大的路径。跟这个错误有什么关系吗?

尝试 OpenCover

-targetdir 选项

例如

<Exec Command='$(OpenCoverPath)\OpenCover.Console.exe -targetdir:"C:\MyPath" "-target: $(XUnitPath)\xunit.console.exe" "-targetargs:UnitTest1.dll UnitTest2.dll UnitTest3.dll /noshadow" "-output:c:\OpenCoverReport\coverage.xml" '/>