【发布时间】:2016-11-08 06:09:17
【问题描述】:
我正在使用带有 .NET Core 项目的 Visual Studio 2015。我已经正确设置了所有单元测试,测试运行良好,执行良好。
唯一缺少的是代码覆盖率突出显示。它曾经与我的 .Net4.5 应用程序一起使用。我错过了什么吗?
我将 XUnit 与 .NET Core 一起使用。我加了Microsoft.CodeCoverage,但是好像没有什么区别。
这是我的 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"
]
}
}
}
还有其他人对此有任何运气吗?
【问题讨论】:
-
您的 Visual Studio 版本是多少?只有企业版具有代码覆盖率突出显示。
-
我在企业版
-
将您的
debugtype构建选项从portable更改为full应该可以解决您的问题。 -
@nulltoken 你是个天才!将此作为答案发布,我会投票一千次。 :)
-
@l3utterfly 完成 ;-)
标签: c# unit-testing visual-studio-2015 asp.net-core