msbuildsonarqubeazure-devopstrx

VSTS SonarQube cannot find TRX file


I am using Visual Studio Team Services to carry out an automated build, and using SonarQube to display Code Quality, Coverage, etc. I am also using a privately hosted build agent.

The build steps all work successfully with data being processed and populated through to SonarQube which is great. However, no code coverage is being displayed in SonarQube. After looking through the logs in VSTS I found that SonarQube is looking for the .trx file (which contains code coverage) in a different directory to the one that VSTS publishes the .trx file to.

So when VSTS builds the solution it creates the test results file here: C:\agent_work\3\s\TestResults

But SonarQube is trying to use test results from here: C:\agent_work\3\TestResults

On the build server, if I manually copy the .trx file into the correct location and then run the build again, the code coverage all works fine and processes through to SonarQube. So the issue is definitely the mismatch of the locations where the .trx is published and where it is to be picked up form.

I can't find a way of changing the publish location, or the SonarQube source location.

Please help!


Solution

  • This is a known issue, and will be fixed by the next release. See: https://jira.sonarsource.com/browse/SONARMSBRU-262.

    We just announced the RC versions of the products that have this fix, you can give them a try. See this thread.