We are using Azure pipeline task “SonarCloudAnalyze@1” on a Microsoft hosted agent but we still see this warning:
“CodeCoverage.exe is deprecated. Use dotnet-coverage global tool or Microsoft.CodeCoverage.Console instead. Some features of CodeCoverage.exe will be removed in next release of Visual Studio.”
The task prints these versions:
INFO: SonarScanner 4.8.1.3023
INFO: Java 17.0.9 Eclipse Adoptium (64-bit)
INFO: Windows Server 2022 10.0 amd64
Do we have do do something so we don’t see this warning?
So it must be your sonar task there executes CodeCoverage.exe?
The following log from the task “- task: SonarCloudAnalyze@1” and ONLY from this task:
Calling the TFS Processor executable...
Attempting to locate the CodeCoverage.exe tool...
Attempting to locate the CodeCoverage.exe tool using setup configuration...
Code coverage command line tool: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe
Fetching code coverage report information from TFS...
Attempting to locate a test results (.trx) file...
Looking for TRX files in: D:\a\1\TestResults
No test results files found
Did not find any binary coverage files in the expected location.
Falling back on locating coverage files in the agent temp directory.
Searching for coverage files in D:\a\_temp
All matching files: count=4
D:\a\_temp\2efc7fe8-376c-42e1-ad48-7a7a292756cc\VssAdministrator_fv-az610-807_2023-11-29.08_34_42.coverage
D:\a\_temp\e4e058e6-bc6e-41c8-b828-94c788473cbc\VssAdministrator_fv-az610-807_2023-11-29.08_35_06.coverage
D:\a\_temp\VssAdministrator_fv-az610-807_2023-11-29_08_34_09\In\fv-az610-807\VssAdministrator_fv-az610-807_2023-11-29.08_34_42.coverage
D:\a\_temp\VssAdministrator_fv-az610-807_2023-11-29_08_34_46\In\fv-az610-807\VssAdministrator_fv-az610-807_2023-11-29.08_35_06.coverage
Unique coverage files: count=2
D:\a\_temp\2efc7fe8-376c-42e1-ad48-7a7a292756cc\VssAdministrator_fv-az610-807_2023-11-29.08_34_42.coverage
D:\a\_temp\e4e058e6-bc6e-41c8-b828-94c788473cbc\VssAdministrator_fv-az610-807_2023-11-29.08_35_06.coverage
Executing file C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe
Args: analyze /output:D:\a\_temp\2efc7fe8-376c-42e1-ad48-7a7a292756cc\VssAdministrator_fv-az610-807_2023-11-29.08_34_42.coveragexml D:\a\_temp\2efc7fe8-376c-42e1-ad48-7a7a292756cc\VssAdministrator_fv-az610-807_2023-11-29.08_34_42.coverage
Working directory: D:\a\_temp\2efc7fe8-376c-42e1-ad48-7a7a292756cc
Timeout (ms):60000
Process id: 7032
CodeCoverage.exe is deprecated. Use dotnet-coverage global tool or Microsoft.CodeCoverage.Console instead. Some features of CodeCoverage.exe will be removed in next release of Visual Studio.
Process returned exit code 0
Executing file C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe
Args: analyze /output:D:\a\_temp\e4e058e6-bc6e-41c8-b828-94c788473cbc\VssAdministrator_fv-az610-807_2023-11-29.08_35_06.coveragexml D:\a\_temp\e4e058e6-bc6e-41c8-b828-94c788473cbc\VssAdministrator_fv-az610-807_2023-11-29.08_35_06.coverage
Working directory: D:\a\_temp\e4e058e6-bc6e-41c8-b828-94c788473cbc
Timeout (ms):60000
Process id: 2920
CodeCoverage.exe is deprecated. Use dotnet-coverage global tool or Microsoft.CodeCoverage.Console instead. Some features of CodeCoverage.exe will be removed in next release of Visual Studio.
Process returned exit code 0
Coverage report conversion completed successfully.
“CodeCoverage.exe is deprecated. Use dotnet-coverage global tool or Microsoft.CodeCoverage.Console instead. Some features of CodeCoverage.exe will be removed in next release of Visual Studio.”
SonarCloud itself does not calculate coverage. To include coverage results in your analysis, you must set up a third-party coverage tool and configure SonarCloud to import the results
Please try to use the task SonarCloudAnalyze@5, this is the latest version.
Old versions used the CodeCoverage tool as can be seen on older docs:
Once trx files have been found, their .coverage counterpart are searched as well and the scanner tries to convert them to .coveragexml files that will be uploaded to SonarQube. CodeCoverage.exe tool is used for that, and the scanner also needs to find a path to that tool, following this search path(…)
Actually, you are right, I’m sorry. The SonarCloudAnalyze@1 task is the correct one for SonarCloudAnalyze. The “v5” task is only for SonarQubeAnalyze.
It seems that the updates to make the process independent of CodeCoverage.exe haven’t been released yet and it looks like they’ll be included in the next release of SonarScanner for MSBuild.
It seems that the new version of the DevOps 2022 extension is out, but the same error continues to occur
Starting: Run Code Analysis
==============================================================================
Task : Run Code Analysis
Description : Run scanner and upload the results to the SonarQube server.
Version : 5.19.0
Author : sonarsource
Help : Version: 5.19.0. This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.
[More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
==============================================================================
...
Looking for TRX files in: C:\agent\_work\1\TestResults
No test results files found
Did not find any binary coverage files in the expected location.
Falling back on locating coverage files in the agent temp directory.
Searching for coverage files in C:\agent\_work\_temp
All matching files: count=2
C:\agent\_work\_temp\0422a689-74bd-416c-8d15-a7a89adca717\deployearth_SONARQUBE01_2024-01-25.12_43_36.coverage
C:\agent\_work\_temp\deployearth_SONARQUBE01_2024-01-25_12_41_23\In\SONARQUBE01\deployearth_SONARQUBE01_2024-01-25.12_43_36.coverage
Unique coverage files: count=1
C:\agent\_work\_temp\0422a689-74bd-416c-8d15-a7a89adca717\deployearth_SONARQUBE01_2024-01-25.12_43_36.coverage
Executing file C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe
Args: analyze /output:C:\agent\_work\_temp\0422a689-74bd-416c-8d15-a7a89adca717\deployearth_SONARQUBE01_2024-01-25.12_43_36.coveragexml C:\agent\_work\_temp\0422a689-74bd-416c- 8d15- a7a89adca717\deployearth_SONARQUBE01_2024-01-25.12_43_36.coverage
Working directory: C:\agent\_work\_temp\0422a689-74bd-416c-8d15-a7a89adca717
Timeout (ms):60000
Process id: 11456
CodeCoverage.exe is deprecated. Use dotnet-coverage global tool or Microsoft.CodeCoverage.Console instead. Some features of CodeCoverage.exe will be removed in next release of Visual Studio.
Thank you for your prompt response, in DevOps 2022 the sonar extension is in version 5.19, which may still need to be updated.
I only have this update:
Extension details: Detect bugs, vulnerabilities and code smells across project branches and pull requests.
Publisher: SonarSource
Installed version: 5.19.0 (Latest)
Last updated: 24 ene 2024 at 19:36 GMT-3