I'm seeing the following in VS 2017 Enterprise on a csproj, Project1, that's being built on .Net 4.5.2:
18>------ Rebuild All started: Project: Project1, Configuration: Debug Any CPU ------
18>C:\git\27844-2-StyleCop\company\Class1.cs(26,31,26,47): warning CS0169: The field 'Class1.field' is never used
18>C:\git\27844-2-StyleCop\company\Class2.cs(31,48,31,69): warning SA1214: Readonly fields must appear before non-readonly fields
18>C:\git\27844-2-StyleCop\company\Interface1.cs(9,45,9,69): warning SA1127: Generic type constraints must be on their own line
18> Project1 -> C:\git\27844-2-StyleCop\company\Project1\Project1\bin\Debug\Project1.dll
18> Running Code Analysis...
18> Code Analysis Complete -- 0 error(s), 0 warning(s)
Clearly there's 3 warnings there being picked up by a combination of the built-in C# DotNetAnalyzers and version 1.0.2 of the StyleCop.Analyzers. What I'm wondering is why the:
18> Code Analysis Complete - 0 error(s), 0 warning(s)
section is not:
18> Code Analysis Complete - 0 error(s), 3 warning(s)
and why none of these warnings (or errors for that matter, as I've seen this happen with rules treated as errors) are appearing in the code analysis log file, Project1.dll.CodeAnalysisLog.xml
I've tried:
Enable Code Analysis on Build
in the project propertiesTreat Warnings as Errors
in the project propertiesSuppress warnings
in the project propertiesAm I doing something wrong?
Build and Code Analysis are separate steps.
StyleCop Analyzers do not run in the Code Analysis step (as per https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/2456 ).