如何将FxCop分析用于新的MsBuild Sonar runner?

如何将FxCop分析用于新的MsBuild Sonar runner?,msbuild,sonarqube,fxcop,sonar-runner,sonarqube-msbuild-runner,Msbuild,Sonarqube,Fxcop,Sonar Runner,Sonarqube Msbuild Runner,我正在尝试在.NET项目中从旧的Sonar runner迁移到新的MsBuild Sonar runner 我遇到的最后一个问题是做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 pr

我正在尝试在.NET项目中从旧的Sonar runner迁移到新的MsBuild Sonar runner

我遇到的最后一个问题是做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.skipifnotbuild=“true”
,但没有帮助

我做错了什么?如何参数化新的MsBuild sonar runner以使FxCop分析工作正常

这些是我正在执行的命令(我修改了文件名和路径):
1.声纳赛跑者开始

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…

  • 重拾器分析:
  • inspectcode.exe/o=resharperresults.xml MySolution.sln

  • 转轮端:

  • MSBuild.SonarQube.Runner.exe end

    我建议升级到新发布的MSBuild.SonarQube Runner版本1.0.1,这将强制禁用Visual Studio引导程序插件。迁移所有项目以使用MSBuild SonarQube运行程序后,应从SonarQube服务器卸载Visual Studio引导程序插件

    然后,所有SonarQube服务器和JDBC属性,如
    sonar.host.url
    sonar.JDBC.url
    都通过
    SonarQube.Analysis.xml
    文件传递,而不是通过命令行传递

    以下属性无效:
    sonar.visualstudio.testProjectPattern
    sonar.dotnet.excludeGeneratedCode
    sonar.cs.fxcop.fxCopCmdPath
    sonar.visualstudio.solution
    sonar.dotnet.buildConfigurations

    sonar.language
    可以删除,因为自SonarQube版本4.2以来,SonarQube支持多语言项目

    有关OpenCover,请查看:

    对于ReSharper,请访问:


    FxCop本机受支持,当在质量配置文件中启用FxCop规则时,FxCop将在
    msbuild期间执行。

    或者对于新的运行程序,FxCop报告必须手动生成,类似于ReSharper报告?不,FxCop应该在msbuild期间强制执行-也就是说,除非您大量自定义了.csproj和MSBuild文件-是这样吗?您可以删除未使用的属性:sonar.cs.fxcop.fxCopCmdPath、sonar.visualstudio.solution、sonar.visualstudio.TestProjectPattern如果我从TeamCity运行SonarQube,我应该在TeamCity服务器上安装FxCop吗?FxCop随Visual Studio提供。如果您想在SonarQube分析中运行FxCop规则,那么是的,您应该在构建机器上安装它。但是,如果禁用所有FxCop规则,则不需要安装它。