Adding Code Coverage for ASPNET CORE projects
If you are not able to get code coverage when you run unit tests through Visual Studio for ASPNET core projects. Try following the below steps and hope that helps. 1) Add below Nuget packages to your VS test project Microsoft.NET.Test.Sdk MSTest.TestAdapter MSTest.TestFramework 2) Add "DebugType" as "Full" in the ASPNET core project <PropertyGroup> ... <DebugType>Full</DebugType> </PropertyGroup> 3) Add "Microsoft.CodeCoverage" Nuget package to the ASPNET core project.