1

After updating to the MSBuild Runner V1 SonarQube picks up the reference to WCF Datasource files and tries to analyse it. This breaks ofc due to the length of the full path being longer than limit set by MS and logs the following error:

Cannot evaluate the item metadata "%(FullPath)". The item metadata "%(FullPath)"

Is there a way to exclude datasource files. We tried adding *.datasource to the exclusion tab but made no difference.

Using MSbuild.SonarQube.Runner V1 with SonarQube 5.1

Pascal Berger
  • 4,262
  • 2
  • 30
  • 54
fluf
  • 1,261
  • 2
  • 22
  • 36
  • I've posted an answer explaining how to exclude individual files by changing the MSBuild project file. However, I would have expected the standard exclusion mechanism to work too. Which analysis property did you set - sonar.global.exclusions? sonar.exclusions? – duncanp Aug 10 '15 at 09:29
  • I added the exclusion Settings->Exclusions – fluf Aug 13 '15 at 09:07

1 Answers1

1

You can exclude individual files from analysis by setting the metadata property SonarQubeExclude in the individual project files e.g.

<ItemGroup>
  <Compile Include="MyFile.cs">
    <!-- Exclude the file from analysis -->
    <SonarQubeExclude>true</SonarQubeExclude>
  </Compile>
</ItemGroup>

See the documentation on GitHub for more info.

You should be able to use an MSBuild ItemGroupDefinition to automatically set the metadata item for all *.datasource files.

duncanp
  • 1,572
  • 1
  • 10
  • 8
  • Not sure if I can mark this as an answer, we had to revert to the sonarqube C# 4.0 plugin and use the Sonar Runner because Codecoverage is not begin picked up with C# plugin 4.1 and MSBuild runner 1 and no-one is able to provide any information about it. The previous version excluded *.DataSource files without any configuration. @duncanpMS – fluf Aug 17 '15 at 06:13