我们正在使用MSBuild的SonarQube扫描器(1.1.0.0),并且有一个包含多个项目的解决方案。
在我们提供给扫描仪cli的解决方案根文件夹中有一个SonarQube.Analysis.xml。
<SonarQubeAnalysisProperties xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.sonarsource.com/msbuild/integration/2015/1">
<Property Name="sonar.cs.opencover.reportsPaths">output/nunit-coverage.xml</Property>
<Property Name="sonar.cs.nunit.reportsPaths">output/nunit-result.xml</Property>
<Property Name="sonar.exclusions">Project1/Migrations/*</Property>
<Property Name="sonar.coverage.exclusions">Project1/Migrations/*</Property>
</SonarQubeAnalysisProperties>现在的问题是:Project1/Migrations/*似乎没有被排除,因为在扫描期间Base dir被设置为.../Project1。解决方案中的所有其他项目都会发生同样的情况。结果是.../Project1/Project1/Migrations/*是一个未知路径。
那么,在使用MSBuild扫描器时,从覆盖率和源码分析中排除整个目录的推荐方法是什么?
发布于 2017-07-07 15:54:33
尝试将排除项放入项目文件(.csproj)本身,如下所示:
<ItemGroup>
<SonarQubeSetting Include="sonar.exclusions">
<Value>**/Migrations/*</Value>
</SonarQubeSetting>
</ItemGroup>参见Appendix 2: Configuring the SonarQube Scanner for MSBuild。
https://stackoverflow.com/questions/41674375
复制相似问题