SonarLint: VS2017 show as warnings?


(Graeme Baillie) #1

Is there any way to change all the problems found to be warnings with a color other than red for everything that sonarlint finds?

We have a large legacy system and its becoming a bit much to see new actul errors in amongst the sonarlint ones


(Valeri Hristov) #2

SonarLint should be raising warnings (yellow), not errors. Do you have Treat warnings as errors enabled in your projects?

If it has to be enabled you could prevent MSBuild from treating certain warnings as errors by adding the WarningsNotAsErrors property to your project. See the following article for more information:
https://docs.microsoft.com/en-us/visualstudio/msbuild/common-msbuild-project-properties?view=vs-2017


(Kevin Keenan) #3

Is it possible to have normal compiler warnings treated as errors, but have errors raised by SonarLint to be treated as warnings?


(Valeri Hristov) #4

Yes, but it is cumbersomeā€¦ You would need to specify all SonarC# warning keys (~350 and increasing) in the WarningsNotAsErrors element in the project. Other option is to list all compiler warnings you want treated as errorsā€¦