Excluding a file from the roslyn analyzers -
since have lot of generated code, roslyn analyzers go crazy code. there way exclude files analyzers?
there no way explicitly "don't run analyzer on generated code". have handle manually.
i believe heuristics used follows. (i took list giovanni bassi, 1 of authors of code cracker) file auto generated if of following conditions met:
it has 1 of these attributes:
- debuggernonusercodeattribute
- generatedcodeattribute
the file path contains:
- *.g.cs
- *.designer.cs
- *.assemblyinfo.cs
- *.generated.cs
- *.g.cs
- *.g.i.cs
- *.assemblyattributes.cs
- temporarygeneratedfile_*.cs
a header comment contains:
<auto-generated>
the code cracker project has number of extension methods detecting generated files. check out generatedcodeanalysisextensions
Comments
Post a Comment