Я пытаюсь перейти со старого бегуна Sonar на новый бегун MsBuild Sonar в проекте .NET.
Последняя проблема, с которой я столкнулся, - это анализ FxCop. Если профиль качества в Sonar содержит какие-либо правила FxCop, я получаю следующую ошибку сборки:
ERROR: Caused by: The property "sonar.cs.fxcop.assembly" must be set and the project must have been built to execute FxCop rules.
This property can be automatically set by the Analysis Bootstrapper for Visual Studio Projects plugin, see: http://docs.codehaus.org/x/TAA1Dg.
If you wish to skip the analysis of not built projects, set the property "sonar.visualstudio.skipIfNotBuilt".
Я много гуглил и нашел несколько довольно старых тем с той же проблемой, но ни одно из решений не помогло.
Я попытался добавить параметр sonar.visualstudio.enable="true"
, но затем получил следующую ошибку:
ERROR: Caused by: Do not use the Visual Studio bootstrapper and set the "sonar.modules" property at the same time.
Тоже пробовал добавить /d:sonar.visualstudio.skipIfNotBuilt="true"
, но не помогло.
Что я делаю неправильно? Как параметризовать новый бегун сонара MsBuild, чтобы анализ FxCop работал?
Вот команды, которые я выполняю (я изменил имена файлов и пути):
1. Начало работы с Sonar runner
MSBuild.SonarQube.Runner.exe begin /key:"MyProject" /name:"MyProject"
/version:"1" /d:sonar.host.url="http://mysonarhost/" /d:sonar.jdbc.dialect="mssql"
/d:sonar.jdbc.url="jdbc:jtds:sqlserver://mysonardb" /d:sonar.jdbc.username="sonar-user"
/d:sonar.jdbc.password="sonar-password" /d:sonar.resharper.cs.reportPath="../../../../resharperresults.xml"
/d:sonar.resharper.solutionFile="MySolution.sln"
/d:sonar.visualstudio.testProjectPattern=".*\.(UnitTests|IntegrationTests)"
/d:sonar.exclusions="obj/**" /d:sonar.dotnet.excludeGeneratedCode="true"
/d:sonar.cs.fxcop.fxCopCmdPath="..\Tools\FxCop.v12.0.21005.1\FxCopCmd.exe"
/d:sonar.visualstudio.solution="MySolution.sln" /d:sonar.dotnet.buildConfigurations="Release"
/d:sonar.language="cs" /d:sonar.sourceEncoding="UTF-8"
/d:sonar.cs.opencover.reportsPaths="..\CodeCoverage\MSTest.Coverage.MySolution.UnitTests.xml"
- MsBuild:
MSBuild.exe targets.msbuild ...
- Анализ ReSharper:
inspectcode.exe /o=resharperresults.xml MySolution.sln
- Конец бегуна:
MSBuild.SonarQube.Runner.exe end