Exclude folders or files from Visual Studio project

I have the same issue as decribed here, but in the scope of SonarLint Visual Studio 2019 extension: https://github.com/SonarSource/sonar-dotnet/issues/2474 . I’m trying to exclude the migrations from analysis.

If I exclude the migrations ‘physically’ from the project, the CPU usage is not a problem anymore. Based on this, I want exclude them ‘logically’ from the analysis, either an entire folder called Migrations and all its files or exclude files ending with Designer.cs.

I tried all that I could find through Google search as there doesn’t seem to be any official documentation:

  1. Configured project on sonarcloud.io, configured exclusion rules **/*.Designer.cs, **/Migrations/**, **/Migrations/*.*, tried all kinds of rules. And connected Visual Studio to the sonarcloud.io because based on some obscure thread, the rules from Sonarcloud.io (or maybe just SonarQube?) might be used by SonarLint as well in connected mode https://groups.google.com/forum/#!msg/sonarlint/Hfen0FcDteg/wVJB-aeEBwAJ

  2. Tried to add same exclusion rules into settings.json file of the SonarLint extension located at C:\Users\{{MyUsername}}\AppData\Roaming\SonarLint for Visual Studio\settings.json

  3. Tried to even disable the entire project, but not sure if this applies to SonarLint

<PropertyGroup>
    <SonarQubeExclude>true</SonarQubeExclude>
  </PropertyGroup>

It’s not clear which settings are valid for SonarLint, or just SonarQube/SonarCloud

I have a paid account on sonarcloud.io, in case there is a solution that requires it. Please help me out or point me to a valid documentation. Thank you.

Looks like the high CPU usage has been fixed in Visual Studio 16.6.2 (without making any exclusions or any other change).

But still would like to know how to exclude folders or files if there is a way