【发布时间】:2014-07-12 10:01:36
【问题描述】:
我正在尝试使用 SonarQube C# 插件分析 .NET C# 项目。 从 C# Plugin 3.0 开始,即使 sonar-project.properties 中的“sonar.fxcop.mode=skip”,FxCop 也会自动执行,因此我将 FxCop 安装到以下目录。
C:\Program Files (x86)\Microsoft FxCop 1.35
当我从 Jenkins 的声纳插件运行 SonarQube Runner 时,出现以下错误。
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: The property "sonar.cs.fxcop.assembly" must be set.
ERROR:
ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Build step 'Invoke Standalone Sonar Analysis' marked build as failure
Finished: FAILUR
我在 SonarQube 上启用了 Visual Studio Bootstrapper,然后再次运行 SonarQube Runner,然后出现以下错误。
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: java.io.IOException: Cannot run program "C:/Program Files (x86)/Microsoft Visual Studio 12.0/Team Tools/Static Analysis Tools/FxCop/FxCopCmd.exe": CreateProcess error=2, ?w?????t?@?
ERROR: Caused by: Cannot run program "C:/Program Files (x86)/Microsoft Visual Studio 12.0/Team Tools/Static Analysis Tools/FxCop/FxCopCmd.exe": CreateProcess error=2, ?w?????t?@?
ERROR: Caused by: CreateProcess error=2, ?w?????t?@?
ERROR:
ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
我将“sonar.fxcop.installDirector=C:/Program Files (x86)/Microsoft FxCop 1.35”添加到 sonar-project.properties,然后再次运行 SonarQube Runner,但发生了同样的错误。
我猜如果 Visual Studio Bootstrapper 禁用并且 sonar-project.properties 正确指定“sonar.cs.fxcop.assembly”和“sonar.fxcop.installDirector”,它工作正常,但我不想指定很多属性在 sonar-project.properties 中。
如何在启用 Visual Studio Bootstrapper 的情况下设置 FxCop 执行路径?
环境:
- SonarQube4.2
- SonarQube 的 C# 插件 3.0
- SonarQube Runner 2.4
声纳项目.properties
sonar.projectKey=xxxxx
sonar.projectVersion=1.0
sonar.projectName=Project Name
sonar.language=cs
sonar.dotnet.key.generation.strategy=safe
sonar.sourceEncoding=UTF-8
# This property is set because it is required by the SonarQube Runner.
# But it is not taken into account because the location of the source
# code is retrieved from the .sln and .csproj files.
sonar.sources=.
sonar.fxcop.mode=skip
sonar.gendarme.mode=skip
sonar.gallio.mode=skip
sonar.ndeps.mode=skip
sonar.stylecop.mode=skip
sonar.fxcop.installDirector=C:/Program Files (x86)/Microsoft FxCop 1.35
问候
【问题讨论】:
标签: c# sonarqube sonar-runner