下面是我正在编写的代码行,用于执行打开封面
<Target Name="Build">
<!--NUnit-->
<Exec Command="...WcfServiceLibrary1thirdpartytoolsNUnitnunit-console-x86.exe ...WcfServiceLibrary1UnitTestProject1binDebugUnitTestProject1.dll /xml=...WcfServiceLibrary1TestResult.xml" />
<!--Open Cover-->
<Exec Command="...WcfServiceLibrary1thirdpartytoolsOpenCoverOpenCover.console.exe -register:user -target:...WcfServiceLibrary1thirdpartytoolsNUnitnunit-console-x86.exe -targetargs:...WcfServiceLibrary1UnitTestProject1binDebugUnitTestProject1.dll /noshadow -output:...WcfServiceLibrary1Coverage.xml" />
<!--Report generator-->
<Exec Command="...WcfServiceLibrary1thirdpartytoolsOpenCoverCoverageReportReportGenerator.exe -reports:mycoveragereport.xml -targetdir:...WcfServiceLibrary1mycoveragereport.xml" />
</Target>
现在我得到的报道报告缺少PDB的声明
<?xml version="1.0" encoding="utf-8"?>
<CoverageSession xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Summary numSequencePoints="0" visitedSequencePoints="0" numBranchPoints="0" visitedBranchPoints="0" sequenceCoverage="0" branchCoverage="0" maxCyclomaticComplexity="0" minCyclomaticComplexity="0" />
<Modules>
<Module skippedDueTo="Filter" hash="B5-EF-91-87-52-88-4E-B0-F8-8C-F4-4C-97-10-C8-D0-C0-7E-55-19">
<FullName>C:WindowsassemblyGAC_32mscorlib2.0.0.0__b77a5c561934e089mscorlib.dll</FullName>
<ModuleName>mscorlib</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="Filter" hash="F9-04-A8-31-CD-FB-23-72-95-63-5D-14-9A-A0-66-8E-7F-44-93-7A">
<FullName>C:WindowsassemblyGAC_32mscorlib2.0.0.0__b77a5c561934e089sorttbls.nlp</FullName>
<ModuleName>mscorlib</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="MissingPdb" hash="DD-C7-B8-46-28-B0-4A-0B-84-CB-A2-DD-7F-EC-4A-98-75-61-4C-17">
<FullName>...WcfServiceLibrary1thirdpartytoolsNUnitnunit-console-x86.exe</FullName>
<ModuleName>nunit-console-x86</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="Filter" hash="6E-30-2E-50-36-FB-60-2C-8E-50-C0-83-54-8B-CC-EA-A8-91-B6-CC">
<FullName>C:WindowsassemblyGAC_32mscorlib2.0.0.0__b77a5c561934e089sortkey.nlp</FullName>
<ModuleName>mscorlib</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="MissingPdb" hash="79-F8-9A-22-4E-29-52-37-00-CF-81-FF-1F-EA-05-EC-74-2A-2E-C8">
<FullName>...WcfServiceLibrary1thirdpartytoolsNUnitlibnunit-console-runner.dll</FullName>
<ModuleName>nunit-console-runner</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="MissingPdb" hash="23-35-8C-86-05-D5-AE-FE-3C-1F-09-A0-86-02-40-7C-4F-CA-59-41">
<FullName>...WcfServiceLibrary1thirdpartytoolsNUnitlibnunit.core.dll</FullName>
<ModuleName>nunit.core</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="MissingPdb" hash="57-DD-20-42-DA-33-B3-EE-DA-8C-8E-25-C9-E5-07-B5-08-62-0F-88">
<FullName>...WcfServiceLibrary1thirdpartytoolsNUnitlibnunit.util.dll</FullName>
<ModuleName>nunit.util</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="MissingPdb" hash="AD-76-2F-3C-5E-F6-77-0D-C6-AD-AF-A3-90-85-28-07-2D-A0-59-50">
<FullName>...WcfServiceLibrary1thirdpartytoolsNUnitlibnunit.core.interfaces.dll</FullName>
<ModuleName>nunit.core.interfaces</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="Filter" hash="2C-99-EE-29-D5-25-03-C4-0E-40-26-9B-F7-DF-C2-68-6E-74-74-31">
<FullName>C:WindowsassemblyGAC_MSILSystem.Configuration2.0.0.0__b03f5f7f11d50a3aSystem.Configuration.dll</FullName>
<ModuleName>System.Configuration</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="Filter" hash="D3-99-70-9D-4C-FD-70-CC-82-00-AA-75-7A-54-8C-25-AC-54-B1-BF">
<FullName>C:WindowsassemblyGAC_MSILSystem2.0.0.0__b77a5c561934e089System.dll</FullName>
<ModuleName>System</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="Filter" hash="C4-AD-0A-97-FF-1D-61-5F-88-89-A6-25-BD-02-5E-E5-F5-1D-6F-20">
<FullName>C:WindowsassemblyGAC_MSILSystem.Xml2.0.0.0__b77a5c561934e089System.Xml.dll</FullName>
<ModuleName>System.Xml</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="Filter" hash="92-44-10-37-4C-84-2D-65-E3-A0-6A-B9-9F-01-42-6A-27-41-4A-8C">
<FullName>C:WindowsassemblyGAC_MSILSystem.Runtime.Remoting2.0.0.0__b77a5c561934e089System.Runtime.Remoting.dll</FullName>
<ModuleName>System.Runtime.Remoting</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="Filter" hash="94-1E-7C-FB-9C-23-D5-E1-43-03-B3-3C-0B-35-BB-9A-83-CC-9B-65">
<FullName>C:WindowsMicrosoft.NetassemblyGAC_32mscorlibv4.0_4.0.0.0__b77a5c561934e089mscorlib.dll</FullName>
<ModuleName>mscorlib</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="MissingPdb" hash="6D-DC-5C-CD-CD-17-D8-34-8A-02-0A-F6-CB-BC-84-81-BD-88-CB-86">
<FullName>...WcfServiceLibrary1thirdpartytoolsNUnitnunit-agent-x86.exe</FullName>
<ModuleName>nunit-agent-x86</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="MissingPdb" hash="23-35-8C-86-05-D5-AE-FE-3C-1F-09-A0-86-02-40-7C-4F-CA-59-41">
<FullName>...WcfServiceLibrary1thirdpartytoolsNUnitlibnunit.core.dll</FullName>
<ModuleName>nunit.core</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="MissingPdb" hash="57-DD-20-42-DA-33-B3-EE-DA-8C-8E-25-C9-E5-07-B5-08-62-0F-88">
<FullName>...WcfServiceLibrary1thirdpartytoolsNUnitlibnunit.util.dll</FullName>
<ModuleName>nunit.util</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="MissingPdb" hash="AD-76-2F-3C-5E-F6-77-0D-C6-AD-AF-A3-90-85-28-07-2D-A0-59-50">
<FullName>...WcfServiceLibrary1thirdpartytoolsNUnitlibnunit.core.interfaces.dll</FullName>
<ModuleName>nunit.core.interfaces</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="Filter" hash="98-5B-33-BC-92-AB-DB-88-FE-EC-F2-8F-04-5B-06-B6-ED-05-0B-00">
<FullName>C:WindowsMicrosoft.NetassemblyGAC_MSILSystemv4.0_4.0.0.0__b77a5c561934e089System.dll</FullName>
<ModuleName>System</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="Filter" hash="84-64-E1-D2-0A-E2-91-23-AD-BD-B9-7A-3C-89-7B-66-65-58-46-1C">
<FullName>C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Runtime.Remotingv4.0_4.0.0.0__b77a5c561934e089System.Runtime.Remoting.dll</FullName>
<ModuleName>System.Runtime.Remoting</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="Filter" hash="E3-30-C9-0B-9B-B1-9B-30-08-04-31-DB-0F-94-7C-B3-A9-8B-5B-75">
<FullName>C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Configurationv4.0_4.0.0.0__b03f5f7f11d50a3aSystem.Configuration.dll</FullName>
<ModuleName>System.Configuration</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="Filter" hash="A0-AB-0F-DB-C8-A9-ED-50-B7-8B-8A-F2-59-CF-35-5E-E5-F6-78-AF">
<FullName>C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Xmlv4.0_4.0.0.0__b77a5c561934e089System.Xml.dll</FullName>
<ModuleName>System.Xml</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="Filter" hash="7E-B6-09-DE-71-47-47-2D-10-E4-4A-18-28-FB-3D-17-16-8C-88-6D">
<FullName>C:WindowsMicrosoft.NetassemblyGAC_32System.Webv4.0_4.0.0.0__b03f5f7f11d50a3aSystem.Web.dll</FullName>
<ModuleName>System.Web</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="Filter" hash="9F-62-A2-66-54-66-BC-CE-FD-0D-1B-20-6E-F7-50-CC-76-C2-6F-D4">
<FullName>C:WindowsassemblyGAC_32System.Web2.0.0.0__b03f5f7f11d50a3aSystem.Web.dll</FullName>
<ModuleName>System.Web</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="MissingPdb" hash="23-35-8C-86-05-D5-AE-FE-3C-1F-09-A0-86-02-40-7C-4F-CA-59-41">
<FullName>...WcfServiceLibrary1thirdpartytoolsNUnitlibnunit.core.dll</FullName>
<ModuleName>nunit.core</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="Filter" hash="98-5B-33-BC-92-AB-DB-88-FE-EC-F2-8F-04-5B-06-B6-ED-05-0B-00">
<FullName>C:WindowsMicrosoft.NetassemblyGAC_MSILSystemv4.0_4.0.0.0__b77a5c561934e089System.dll</FullName>
<ModuleName>System</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="MissingPdb" hash="C8-69-A6-5A-0E-1E-E0-29-EB-EF-CA-C5-2C-E2-B7-EB-F6-D9-64-1A">
<FullName>...WcfServiceLibrary1thirdpartytoolsNUnitpnunit.framework.dll</FullName>
<ModuleName>pnunit.framework</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="MissingPdb" hash="F9-30-3E-D0-DF-D4-B8-50-24-2D-CB-99-08-61-9C-77-28-1C-6D-29">
<FullName>...WcfServiceLibrary1thirdpartytoolsNUnitpnunit-agent.exe</FullName>
<ModuleName>pnunit-agent</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="MissingPdb" hash="AD-76-2F-3C-5E-F6-77-0D-C6-AD-AF-A3-90-85-28-07-2D-A0-59-50">
<FullName>...WcfServiceLibrary1thirdpartytoolsNUnitlibnunit.core.interfaces.dll</FullName>
<ModuleName>nunit.core.interfaces</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="MissingPdb" hash="50-42-5D-72-64-97-F8-84-32-24-43-4B-DF-ED-F6-E0-13-A5-E5-0D">
<FullName>...AppDataLocalTempnunit20ShadowCopyCache4380_635168510637584953Tests_111289631assemblydl3f065302a85aa24e8_1fc4ce01UnitTestProject1.dll</FullName>
<ModuleName>UnitTestProject1</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="MissingPdb" hash="13-4C-94-D1-A1-A5-D9-8F-F1-E4-CE-A7-87-EF-CC-42-FC-6B-CA-BC">
<FullName>...AppDataLocalTempnunit20ShadowCopyCache4380_635168510637584953Tests_111289631assemblydl3f468205a 03c8368_6cb0cd01nunit.framework.dll</FullName>
<ModuleName>nunit.framework</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="MissingPdb" hash="79-F8-9A-22-4E-29-52-37-00-CF-81-FF-1F-EA-05-EC-74-2A-2E-C8">
<FullName>...WcfServiceLibrary1thirdpartytoolsNUnitlibnunit-console-runner.dll</FullName>
<ModuleName>nunit-console-runner</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="Filter" hash="84-64-E1-D2-0A-E2-91-23-AD-BD-B9-7A-3C-89-7B-66-65-58-46-1C">
<FullName>C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Runtime.Remotingv4.0_4.0.0.0__b77a5c561934e089System.Runtime.Remoting.dll</FullName>
<ModuleName>System.Runtime.Remoting</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="Filter" hash="E3-30-C9-0B-9B-B1-9B-30-08-04-31-DB-0F-94-7C-B3-A9-8B-5B-75">
<FullName>C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Configurationv4.0_4.0.0.0__b03f5f7f11d50a3aSystem.Configuration.dll</FullName>
<ModuleName>System.Configuration</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="Filter" hash="A0-AB-0F-DB-C8-A9-ED-50-B7-8B-8A-F2-59-CF-35-5E-E5-F6-78-AF">
<FullName>C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Xmlv4.0_4.0.0.0__b77a5c561934e089System.Xml.dll</FullName>
<ModuleName>System.Xml</ModuleName>
<Classes />
</Module>
<Module skippedDueTo="MissingPdb" hash="FF-78-B2-8E-E7-37-5C-12-16-D2-B5-9F-24-7A-E2-2D-4B-AC-F2-3D">
<FullName>...AppDataLocalTempnunit20ShadowCopyCache4380_635168510637584953Tests_111289631assemblydl378ee3213e91005a5_1fc4ce01WcfServiceLibrary1.dll</FullName>
<ModuleName>WcfServiceLibrary1</ModuleName>
<Classes />
</Module>
</Modules>
</CoverageSession>
我已经在dll所在的相应文件夹中创建了pdbs,但仍然无法弄清楚为什么OpenCover找不到它们。请帮忙。提前致谢
执行 nunit 时需要使用 /noshadow,或者使用 -targetdir: 和 OpenCover。
现在我可以看到您尝试使用 /noshadow,但看起来您可能没有正确构建命令行(它可能只是错误,因为您修改了它以隐藏路径并无意中对其进行了编辑)。
您需要使用引号来确保打算发送到nunit的所有参数保持在一起,但是由于您使用的是msbuild,因此您需要转义它们,即
<Exec Command=""...WcfServiceLibrary1thirdpartytoolsOpenCoverOpenCover.console.exe" -register:user "-target:...WcfServiceLibrary1thirdpartytoolsNUnitnunit-console-x86.exe" "-targetargs:...WcfServiceLibrary1UnitTestProject1binDebugUnitTestProject1.dll /noshadow" "-output:...WcfServiceLibrary1Coverage.xml"" />