Reputation: 4068
Is it possible to tell Visual Studio to not analyze a specific file? In this case, GlobalSuppressions.cs. I can't find any setting for it in options.
I'm also trying to avoid messing up my code with suppress statements, so I want to keep GlobalSuppressions.cs, but not analyze it.
Upvotes: 1
Views: 71
Reputation: 112672
You can use preprocessor directives:
#pragma warning disable IDE0076
CSharpCodeProducingTheWarnings();
#pragma warning restore IDE0076
You can specify a comma delimited list of warnings if you want to suppress more than one warning.
You can also omit the #pragma warning restore
to make the suppression active until the end of the file.
Upvotes: 1
Reputation: 370
You can add the following to your root level .editorconfig
file:
[yourfile.cs]
# Disable analyzers for a specific file
dotnet_diagnostic.CAxxxx.severity = none
CAxxxx should be replaced with a specific code analyzer rule you want to disable. In your case set it to none for disabling all analyzers on the file.
Hope this helps!
🤞🏼
Upvotes: 2