简体   繁体   English

SonarRunner因缺少FxCop而失败

[英]SonarRunner fails because of missing FxCop

My TFS 2013 build fails with the following error: 我的TFS 2013构建失败,并出现以下错误:

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".

I do not have or want the FxCop assembly. 我没有或想要FxCop程序集。 FxCop is not compatible with .NET 4.5 anymore. FxCop与.NET 4.5不再兼容。 I use SonarQube 5.1.1 and SonarRunner 2.4. 我使用SonarQube 5.1.1和SonarRunner 2.4。 I have plugins for C++ and C#. 我有C ++和C#的插件。 How can I run SonarRunner without FxCop? 没有FxCop的情况下如何运行SonarRunner?

Remove the FxCop rules from your profile (you can locate them by doing a Repository=FxCop search within the profile). 从您的配置文件中删除FxCop规则(您可以通过在配置文件中执行Repository = FxCop搜索来找到它们)。 Then FxCop won't be invoked and your analysis will work. 然后,将不会调用FxCop,并且您的分析将起作用。

FxCop is actually compatible with Framework 4.5 and up, but you need to grab the Code Analysis location that comes with Visual Studio. FxCop实际上与Framework 4.5及更高版本兼容,但是您需要获取Visual Studio附带的Code Analysis位置。

The default location is: 默认位置是:

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\FxCop

So the simplest way to get it working is to install a compatible version of Visual Studio on your build server, an Express edition of 2013 should do. 因此,使其正常工作的最简单方法是在构建服务器上安装兼容版本的Visual Studio,而Express版本的2013应该可以。 Or you can copy your own Static Analysis Tools\\FxCop folder over to your build server. 或者,您可以将自己的Static Analysis Tools\\FxCop文件夹复制到构建服务器。

To disable the FxCop rules in Sonar, I believe you can set: 要在Sonar中禁用FxCop规则,我相信您可以设置:

sonar.fxcop.mode=disabled

And in the C# quality profile section of Sonar ensure that all FxCop related rules are disabled. 并且在Sonar的C#质量配置文件部分中,确保所有与FxCop相关的规则均已禁用。

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

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