Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在不使用Sdk样式项目的.NET项目上运行coverlet?_.net_Code Coverage_Coverlet - Fatal编程技术网

如何在不使用Sdk样式项目的.NET项目上运行coverlet?

如何在不使用Sdk样式项目的.NET项目上运行coverlet?,.net,code-coverage,coverlet,.net,Code Coverage,Coverlet,我想尝试一下,但我能找到的唯一的例子是通过dotnet.exe运行它。我的问题是,我们的项目不使用Sdk样式,它们是针对.NET 4.7.2的旧.NET项目 如何使用它们运行coverlet?我正在使用VS2017构建.NET Framework 4.6.1,并安装了.NET Core SDK v2.1.511。我还没有找到一种不使用dotnet运行coverlet的方法,但这对我很有用: 在包管理器控制台中为所有测试项目运行安装包coverlet.msbuild(仅) 然后将类似以下任务的内容

我想尝试一下,但我能找到的唯一的例子是通过
dotnet.exe
运行它。我的问题是,我们的项目不使用Sdk样式,它们是针对.NET 4.7.2的旧.NET项目


如何使用它们运行coverlet?

我正在使用VS2017构建.NET Framework 4.6.1,并安装了.NET Core SDK v2.1.511。我还没有找到一种不使用
dotnet
运行coverlet的方法,但这对我很有用:

在包管理器控制台中为所有测试项目运行
安装包coverlet.msbuild

然后将类似以下任务的内容添加到构建脚本中:

Task("Coverage")
    .IsDependentOn("Build")
    .Does(() =>
{
    StartProcess("dotnet" , new ProcessSettings {
        Arguments = new ProcessArgumentBuilder()
            .Append("test")
            .Append("/p:CollectCoverage=true")
            .Append("/p:CoverletOutputFormat=opencover")
    });
});
通过将
OpenCoverReportsPath=“***.opencover.xml”
添加到我的
SonarBeginSettings
中,我现在可以在SonarQube中获得覆盖率报告