使用Visual Studio Code Coverage和nunit上传单元测试覆盖率和单元测试结果到SonarQube上
SonarQube.Scanner.MSBuild.exe begin /k:"OMDCCQuotes" /d:sonar.host.url="http://myip:9000" /d:sonar.login="mykey" /d:sonar.cs.nunit.reportsPaths="%CD%\NUnitResults.xml" /d:sonar.cs.vscoveragexml.reportsPaths="%CD%\VisualStudio.coveragexml"
MsBuild.exe OMDCCQuotes.sln /t:Rebuild
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe" collect /output:"%CD%\VisualStudio.coverage" "packages\NUnit.ConsoleRunner.3.9.0\tools\nunit3-console.exe" "OMDCCQuotes.Tests.Unit\bin\Debug\OMDCCQuotes.Tests.Unit.dll"
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe" analyze /output:"%CD%\VisualStudio.coveragexml" "%CD%\VisualStudio.coverage"
packages\NUnit.ConsoleRunner.3.9.0\tools\nunit3-console.exe --result=NUnitResults.xml "OMDCCQuotes.Tests.Unit\bin\Debug\OMDCCQuotes.Tests.Unit.dll"
SonarQube.Scanner.MSBuild.exe end /d:sonar.login="mykey"
参考: https://docs.sonarqube.org/pages/viewpage.action?pageId=6389770