Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Code Coverage for .NET Standard project

Tags:

How do I get code coverage results for .NET Standard projects created with Visual Studio 2017?

  • I've tried using the feature that comes with Visual Studio (Menu → Test → Analyze Code Coverage → All tests). That gives me the following report:

    enter image description here

    This is not what I expect because:

    • None of my actual projects are listed, instead I'm only seeing test projects.

    • None of my code in those test projects are listed, instead I'm seeing something called AutoGeneratedProgram.

  • I've tried using dotCover. It just says that it doesn't support my projects.

  • I've tried using OpenCover. It says nothing is covered:

    enter image description here

Now I've run out of things to try. Any help would be appreciated!

like image 852
Mårten Wikström Avatar asked Mar 08 '17 13:03

Mårten Wikström


1 Answers

Problem solved by adding this to my csproj:

<DebugType>Full</DebugType>
like image 91
Mårten Wikström Avatar answered Sep 30 '22 00:09

Mårten Wikström