当在QualityProfile中使用FxCop规则时,MSBuild SonarQube提出了“必须设置sonar.cs.fxcop.assembly”的问题。请参阅下面的异常。
它可以与其他StyleCop和C#规则配合使用。我看过类似的帖子,但找不到解决方案。
我在用 :
C:\Sonar\sonarqube-5.2
C:\Sonar\MSBuild.SonarQube.Runner-1.0.2
Run Code Online (Sandbox Code Playgroud)
已安装以下插件:插件C#4.3插件StyleCop 1.1
针对以下示例项目:
C:\Sonar\sonar-examples-master\projects\languages\csharp\ConsoleApplication1
Run Code Online (Sandbox Code Playgroud)
我正在执行以下命令:
cd Sonar\MSBuild.SonarQube.Runner-1.0.2\
MSBuild.SonarQube.Runner.exe begin /k:"MyProjectKey" /n:"MyProjectName" /v:"MyProjectVersion"
"C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" "C:\Sonar\sonar-examples-master\projects\languages\csharp\ConsoleApplication1\ConsoleApplication1.csproj" /t:Rebuild
MSBuild.SonarQube.Runner.exe end
Run Code Online (Sandbox Code Playgroud)
我试图在.csproj文件中声明程序集的位置,但是没有成功。预期路径是什么样的?
<ItemGroup>
<SonarQubeSetting Include="sonar.cs.fxcop.assembly">
<Value>path to dll</Value>
</SonarQubeSetting>
</ItemGroup>
Run Code Online (Sandbox Code Playgroud)
谢谢您的帮助 !
例外情况:
10:33:14.564 INFO - Sensor org.sonar.plugins.csharp.CSharpFxCopProvider$CSharpF
xCopSensor@1eeeda8
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 12.017s
Final Memory: 14M/113M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher
.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69) …Run Code Online (Sandbox Code Playgroud)