简体   繁体   English

Teamcity,Sonar和C#/。NET

[英]Teamcity, Sonar and C#/.NET

We are trying to use Sonar with TeamCity 8.1.5, SonarQube 5.1.2 and the SonarQube runner build step in TeamCity. 我们正在尝试将Sonar与TeamCity 8.1.5,SonarQube 5.1.2和SonarQube运行程序一起在TeamCity中使用。

Visual Studio 2010, 2012 and 2013 are installed on the build agent. Visual Studio 2010、2012和2013安装在生成代理上。

The solution we try to analyse with SonarQube uses VS2013. 我们尝试使用SonarQube分析的解决方案使用VS2013。

We have a build running where we have tried to use either the MSBuild or Visual Studio build step to build the solution, and then we have a SonarQube runner step to perform the analysis. 我们有一个正在运行的构建,尝试使用MSBuild或Visual Studio的构建步骤来构建解决方案,然后我们有一个SonarQube Runner步骤来执行分析。

Unless we specify the following as "Additional parameters" to the SonarQube build step: 除非我们将以下内容指定为SonarQube构建步骤的“其他参数”:

-Dsonar.cs.fxcop.assembly=PathToDllFromSolution
-Dsonar.fxcop.installDirectory=C:/Program Files (x86)/Microsoft Visual Studio 12.0/Team Tools/Static Analysis Tools/FxCop
-Dsonar.cs.fxcop.fxCopCmdPath=C:/Program Files (x86)/Microsoft Visual Studio 12.0/Team Tools/Static Analysis Tools/FxCop/FxCopCmd.exe 

we get errors like this: 我们得到这样的错误:

 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)
    at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
    at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
    at org.sonar.runner.api.Runner.execute(Runner.java:100)
    at org.sonar.runner.Main.executeTask(Main.java:70)
    at org.sonar.runner.Main.execute(Main.java:59)
    at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.IllegalArgumentException: 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".
    at org.sonar.plugins.fxcop.FxCopConfiguration.checkMandatoryProperties(FxCopConfiguration.java:105)

What do we have to do to avoid having to use the -D for assembly analysis? 为了避免必须使用-D进行装配分析,我们该怎么做?

Attaching screenshots of configuration: 附加配置屏幕截图: 建立步骤 SonarQube步骤

We're building with MSBuild, our build steps are the following and we do not encounter these issues using SQ 5.1.2 & TC 9.1.3, but I do not think that it is an TC issue. 我们正在使用MSBuild进行构建,以下是构建步骤,使用SQ 5.1.2和TC 9.1.3不会遇到这些问题,但是我认为这不是TC问题。

建立步骤

的MSBuild

测试

声纳

我们已升级到最新版本的SonarQube(5.3),现在可与TeamCity一起使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM