.net Core Visual Studio中突出显示代码覆盖率 [英] code coverage highlighting in .net core visual studio

查看:84
本文介绍了.net Core Visual Studio中突出显示代码覆盖率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Visual Studio 2015与.NET Core项目结合使用.我已经正确设置了所有单元测试,测试运行正常,执行正常.

I'm using visual studio 2015, with .NET Core project. I've setup all the unit test properly, the tests run fine, executes fine.

唯一缺少的是代码覆盖范围突出显示.它曾经与我的.Net4.5应用程序一起使用.我想念什么吗?

The only thing missing is code coverage highlighting. It used to work with my .Net4.5 application. Am I missing something?

我正在将XUnit与.NET Core一起使用.我添加了Microsoft.CodeCoverage,但这似乎没有什么区别.

I'm using XUnit with .NET Core. I've added Microsoft.CodeCoverage, but that did not seem to have any difference.

这是我的project.json:

This is my project.json:

{
  "version": "1.0.0-*",
  "buildOptions": {
    "debugType": "portable",
    "copyToOutput": {
      "include": [ "xunit.runner.json" ]
    }
  },
  "dependencies": {
    "System.Runtime.Serialization.Primitives": "4.1.1",
    "xunit": "2.1.0",
    "dotnet-test-xunit": "2.2.0-preview2-build1029",
    "ClanService": { "target": "project" },
    "Utilities": { "target": "project" },
    "UnitTests.Configuration": { "target": "project" },
    "Microsoft.CodeCoverage": "1.0.2"
  },
  "testRunner": "xunit",
  "frameworks": {
    "netcoreapp1.0": {
      "dependencies": {
        "Microsoft.NETCore.App": {
          "type": "platform",
          "version": "1.0.1"
        }
      },
      "imports": [
        "dotnet5.4",
        "portable-net451+win8"
      ]
    }
  }
}

还有其他运气吗?

推荐答案

从.NET Core LTS 1.0.3开始,将debugtype生成选项从portable更改为full应该可以解决您的问题.

As of .NET Core LTS 1.0.3, changing your debugtype build option from portable to full should fix your issue.

这篇关于.net Core Visual Studio中突出显示代码覆盖率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆