Hey there.
sonar.exclusions does not affect the MSBuild step itseelf – only the “end” step of the Scanner for .NET. You can prevent the analyzers from running at all during the build adding this to the relevant .csproj file(s).
<!-- in .csproj -->
<PropertyGroup>
<!-- Exclude the project from analysis -->
<SonarQubeExclude>true</SonarQubeExclude>
</PropertyGroup>
There’s also an interesting solution proposed in this StackOverflow post to systematically apply this setting based on a RegEx.