I have a .net core solution with two xunit test projects. The build runs on Azure DevOps pipeline and I want to publish the test coverage to a SonarQube (Community) server.<
Here is a very good article about configuring your code coverage and publish it to Sonarqube server.
https://allthingssharepoint.wordpress.com/2018/09/10/getting-coverage-reports-with-net-core/
I am assuming that because of the param passed in dot net test task , your last test project data is overwriting the first test project. You need to ensure that all your test cases would run at one go in the same task.
Task would be like below-
Also while preparing analysis on SonarCloud This is either the SonarCloud task or the SonarQube task. You get them from the Marketplace. Apart from the usual Sonar properties (project, key, version) we need to provide 1 extra property under “Advanced”:
sonar.cs.vscoveragexml.reportsPaths=$(Agent.BuildDirectory)\TestResults\TestCoverage.xml
Please refer this and see if it helps.