OpenCover - cannot find PDB

两盒软妹~` 提交于 2019-12-23 19:23:31

问题


I am having some trouble getting OpenCover to work

I have the following folder structure

  • \Tools
  • \Tools\Nunit
  • \Tools\OpenCover
  • \Buildartifacts

When my code compiles, all the compiled code is generated into the BuildArtifacts folder. This includes the dll's and corresponding .pdb files

I am struggling to get OpenCover to run

From powershell I am entering the following command from the root folder:

.\tools\OpenCover\OpenCover.Console.exe -register:user -target:.\tools\nunit\nunit-console.exe -targetargs:".\buildartifacts\MVCControllerTests.dll /noshadow" -filter:+[*]* -output:.\coverage.xml

However I keep getting the message: Committing...

No results - no assemblies that matched the supplied filter were instrumented this could be due to missing PDBs for the assemblies that match the filter please review the output file and refer to the Usage guide (Usage.rtf)

I have looked at OpenCover/NUnit can't find PDB files, and I have the /noshadow switch present in my targetargs

I attempted to move /noshadow to be the first in the targetargs, but then I get errors from nunit

I have also updated nunit-console.exe.config and added the following line to the startup node to ensure that all the tests are executed within .net4 instead of .net3.5

<supportedRuntime version="v4.0.30319">

But that made no difference.

When I viewed coverage.xml file, even though I had the noshadow flag, it still appears that nunit is doing a shadowcopy

eg, this was present:

C:\Users\darren\AppData\Local\Temp\nunit20\ShadowCopyCache\10344_634940293912865718\Tests_275832668\assembly\dl3\db34ecee\a0f236ee_a7f4cd01\TABusinessInterface.DLL

Appreciate any help.


回答1:


The OpenCover WIKI notes that when using PowerShell you should wrap the whole argument in quotes i.e.

-targetargs:".\buildartifacts\MVCControllerTests.dll /noshadow"

becomes

"-targetargs:.\buildartifacts\MVCControllerTests.dll /noshadow"


来源:https://stackoverflow.com/questions/14381884/opencover-cannot-find-pdb

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