How to exclude files/folders in for .NetCore MSBuild

dotnet
exclusions
csharp

(Steven Cooney) #1

Hi all,

How do you exclude files and folders from analysis for .Net Core projects when using the .NetCore MSBuild analyser?

Previously for non .NetCore projects in the .csproj used

  <Target Name="BeforeBuild">
    <ItemGroup>
      <SonarQubeSetting Include="sonar.exclusions">
        <Value>wwwroot\Scripts\libs\**\*,wwwroot\Scripts\*.min.js</Value>
      </SonarQubeSetting>
    </ItemGroup>
  </Target>

But this doesn’t seem to work.

Thanks


(Steven Cooney) #2

@ganncamp Sorry for the direct tag, I was hoping you can help point me towards someone who can assist with the above since I have had no response in over a month?

I don’t know if I am just blind and cannot find any documentation or if this is a bug (I have seen some similar questions around code coverage recently)

Any help would be appreciated,

Thanks


(Nicolas Bontoux) #3

Hi Steven,

Please don’t mention directly people only for the sake of getting more attention. I know you said sorry, but still :wink: The mentioning feature is here to help organize/structure discussions, if it’s abused then it may be disabled altogether.

To your initial question here:

Generally speaking it’s best to first manage exclusions via the UI. That allows a clear definition and tracking under the project settings, and can then be fine-tuned if needed.

In order to then troubleshoot why exclusion settings would not be working, a good approach is to leverage the debug logs of the analysis, and use the approach described here: