Reputation: 61616
I am a bit confused about the various code analyzers for .NET Core.
If you create a default .NET Core web project, you get the Microsoft.CodeAnalysis.Analyzers
.
In addition, on NuGet, there is Microsoft.CodeQuality.Analyzers
(note the slight difference in the name). After installing it, I see that it contains a lot more rules.
And finally, there is also Microsoft.CodeAnalysis.FxCopAnalyzers
, which appears to contain Microsoft.CodeQuality.Analyzers
.
So what exactly is the relationship between Microsoft.CodeAnalysis.Analyzers
, Microsoft.CodeQuality.Analyzers
and Microsoft.CodeAnalysis.FxCopAnalyzers
? What should my project have?
P.S. After creating a new project, I search NuGet for Microsoft.CodeAnalysis.Analyzers
package (which already exists in my project). It finds it and states my project has v1.1 and that it needs to upgrade it to v2.9.4. However, according to NuGet, v1.1 was released in 2015. This makes no sense as I am using VS2019 and there have been plenty of releases of this analyzer between 2015 and 2019.
However, when I upgrade the package to 2.9.4 - the analyzer has the same 3 rules that v1.1 had. So what exactly am I upgrading?
Upvotes: 5
Views: 1954
Reputation: 36740
This is described here: https://github.com/dotnet/roslyn-analyzers/blob/master/README.md
In summary:
This package contains common code quality improvement rules that are not specific to usage of any particular API
Upvotes: 4