打开盖子中缺少PDB

时间:2013-10-08 12:43:51

标签: msbuild nunit code-coverage opencover

下面是我写的代码行,用于执行打开的封面

<Target Name="Build">
     <!--NUnit-->
    <Exec Command="...\WcfServiceLibrary1\thirdparty\tools\NUnit\nunit-console-x86.exe ...\WcfServiceLibrary1\UnitTestProject1\bin\Debug\UnitTestProject1.dll /xml=...\WcfServiceLibrary1\TestResult.xml" />
    <!--Open Cover-->
    <Exec Command="...\WcfServiceLibrary1\thirdparty\tools\OpenCover\OpenCover.console.exe -register:user -target:...\WcfServiceLibrary1\thirdparty\tools\NUnit\nunit-console-x86.exe -targetargs:...\WcfServiceLibrary1\UnitTestProject1\bin\Debug\UnitTestProject1.dll /noshadow -output:...\WcfServiceLibrary1\Coverage.xml" />
 <!--Report generator-->
<Exec Command="...\WcfServiceLibrary1\thirdparty\tools\OpenCover\CoverageReport\ReportGenerator.exe -reports:mycoveragereport.xml -targetdir:...\WcfServiceLibrary1\mycoveragereport.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:\Windows\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.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:\Windows\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\sorttbls.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>...\WcfServiceLibrary1\thirdparty\tools\NUnit\nunit-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:\Windows\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\sortkey.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>...\WcfServiceLibrary1\thirdparty\tools\NUnit\lib\nunit-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>...\WcfServiceLibrary1\thirdparty\tools\NUnit\lib\nunit.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>...\WcfServiceLibrary1\thirdparty\tools\NUnit\lib\nunit.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>...\WcfServiceLibrary1\thirdparty\tools\NUnit\lib\nunit.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:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.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:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.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:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.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:\Windows\assembly\GAC_MSIL\System.Runtime.Remoting\2.0.0.0__b77a5c561934e089\System.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:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.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>...\WcfServiceLibrary1\thirdparty\tools\NUnit\nunit-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>...\WcfServiceLibrary1\thirdparty\tools\NUnit\lib\nunit.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>...\WcfServiceLibrary1\thirdparty\tools\NUnit\lib\nunit.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>...\WcfServiceLibrary1\thirdparty\tools\NUnit\lib\nunit.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:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.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:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Remoting\v4.0_4.0.0.0__b77a5c561934e089\System.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:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.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:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.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:\Windows\Microsoft.Net\assembly\GAC_32\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.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:\Windows\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.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>...\WcfServiceLibrary1\thirdparty\tools\NUnit\lib\nunit.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:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.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>...\WcfServiceLibrary1\thirdparty\tools\NUnit\pnunit.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>...\WcfServiceLibrary1\thirdparty\tools\NUnit\pnunit-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>...\WcfServiceLibrary1\thirdparty\tools\NUnit\lib\nunit.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>...\AppData\Local\Temp\nunit20\ShadowCopyCache\4380_635168510637584953\Tests_111289631\assembly\dl3\f065302a\85aa24e8_1fc4ce01\UnitTestProject1.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>...\AppData\Local\Temp\nunit20\ShadowCopyCache\4380_635168510637584953\Tests_111289631\assembly\dl3\f468205a\003c8368_6cb0cd01\nunit.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>...\WcfServiceLibrary1\thirdparty\tools\NUnit\lib\nunit-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:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Remoting\v4.0_4.0.0.0__b77a5c561934e089\System.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:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.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:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.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>...\AppData\Local\Temp\nunit20\ShadowCopyCache\4380_635168510637584953\Tests_111289631\assembly\dl3\78ee3213\e91005a5_1fc4ce01\WcfServiceLibrary1.dll</FullName>
      <ModuleName>WcfServiceLibrary1</ModuleName>
      <Classes />
    </Module>
  </Modules>
</CoverageSession>

我已经在dll所在的各个文件夹中创建了pdbs仍然无法弄清楚为什么OpenCover无法找到它们。请帮忙。提前致谢

1 个答案:

答案 0 :(得分:3)

执行nunit时需要使用 / noshadow ,或者需要使用 -targetdir: OpenCover。

现在我可以看到您尝试使用 / noshadow ,但看起来您可能没有正确构建命令行(它可能只是错误,因为您修改它以隐藏路径并且无意中编辑它)。

您需要使用引号来确保您打算发送给nunit的所有参数保持在一起,但因为您使用的是msbuild you need to escape them,即

<Exec Command="&quot;...\WcfServiceLibrary1\thirdparty\tools\OpenCover\OpenCover.console.exe&quot; -register:user &quot;-target:...\WcfServiceLibrary1\thirdparty\tools\NUnit\nunit-console-x86.exe&quot; &quot;-targetargs:...\WcfServiceLibrary1\UnitTestProject1\bin\Debug\UnitTestProject1.dll /noshadow&quot; &quot;-output:...\WcfServiceLibrary1\Coverage.xml&quot;" />