Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.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
Powershell 将TFS 2017中最后生成的.Coverage转换为SonarQubee的Coverage XML_Powershell_Tfs_Azure Devops_Sonarqube_Tfsbuild - Fatal编程技术网

Powershell 将TFS 2017中最后生成的.Coverage转换为SonarQubee的Coverage XML

Powershell 将TFS 2017中最后生成的.Coverage转换为SonarQubee的Coverage XML,powershell,tfs,azure-devops,sonarqube,tfsbuild,Powershell,Tfs,Azure Devops,Sonarqube,Tfsbuild,我正在使用.Net Core Test--收集“代码覆盖率”来生成覆盖率文件,我需要将其转换为sonarqube,问题是我没有导航生成的文件的名称,因为它放置在一个具有guid名称的文件夹中,而文件名本身是一个guid,所有这些都位于TestResults文件夹下 下面的脚本用于将.coverage文件转换为coverage xml,但它适用于整个工作目录 Get-ChildItem -Recurse -Filter "*.coverage" | % { $outfile = "$([Syste

我正在使用.Net Core Test
--收集“代码覆盖率”
来生成覆盖率文件,我需要将其转换为sonarqube,问题是我没有导航生成的文件的名称,因为它放置在一个具有guid名称的文件夹中,而文件名本身是一个guid,所有这些都位于
TestResults
文件夹下

下面的脚本用于将
.coverage
文件转换为
coverage xml
,但它适用于整个工作目录

Get-ChildItem -Recurse -Filter "*.coverage" | % {
$outfile = "$([System.IO.Path]::GetFileNameWithoutExtension($_.FullName)).coveragexml"
$output = [System.IO.Path]::Combine([System.IO.Path]::GetDirectoryName($_.FullName), $outfile)
"Analyse '$($_.Name)' with output '$outfile'..."
. "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Team Tools\Dynamic Code Coverage Tools\codecoverage.exe" analyze /output:$output $_.FullName
}

但是这会转换整个目录,几天后会有很多版本,我只想转换当前版本生成的
.coverage
文件,所以我需要能够隔离当前版本生成的
.coverage
文件。

所以您只需要最后创建的代码coverage文件,您可以过滤
Get ChiledItem
结果以获取最后一个:

Get-ChildItem -Recurse -Filter "*.coverage" | sort LastWriteTime | select -last 1