A common scenario in C# I find is that I would like to:
- Treat most warnings as errors by default
- But, treat a few specific warnings as just warnings.
I still want them to show up as warnings, which is to say that I don't want them to disappear altogether. 'CS0618 Obsolete' is a good example of this.
This cannot be achieved through the C# Project Properties editor, but it can be done by manually editing the .csproj file to add these two MSBuild properties:
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsNotAsErrors>618</WarningsNotAsErrors>
This is vaguely referred to in the docs here, and the list of error codes can be found here.
No comments:
Post a Comment