2017-01-16 20 views
5

MSBuild(1.1.0.0)用にSonarQubeスキャナーを使用し、複数のプロジェクトを含むソリューションを用意しています。MSBuildスキャナーを使用する際に単一ファイルを除外する方法

スキャナの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スキャナを使用している場合、ディレクトリ全体をカバレッジとソースコード解析から除外するための推奨方法は何ですか?

答えて

2

のようなもの、(.csproj)自体をプロジェクトファイルに除外を配置しようとすると:

<ItemGroup> 
    <SonarQubeSetting Include="sonar.exclusions"> 
      <Value>**/Migrations/*</Value> 
    </SonarQubeSetting> 
</ItemGroup> 

Appendix 2: Configuring the SonarQube Scanner for MSBuildを参照してください。

+0

ありがとうございます。これはうまくいくかもしれませんが、私はSonarQube関連の設定を自分のプロジェクトファイルに入れたくありません。 – philipooo

関連する問題