.NET project file analyzers community

Proj1001: Use analyzers for packages

Some NuGet packages come with there own/dedicated Roslyn analyzers; they just contain rules to improve the usage of those packages. In order to get the best out of those NuGet packages, their analyzer(s) should be used.

Analyzers for packages

The following analyzers are known to be beneficial for some packages:

Analyzer(s) Packages Languages
Ardalis.ApiEndpoints.CodeAnalyzers Ardalis.ApiEndpoints. Any
FakeItEasy.Analyzer.CSharp FakeItEasy C#
FakeItEasy.Analyzer.VisualBasic FakeItEasy VB.NET
FluentAssertions.Analyzers FluentAssertions Any
Libplanet.Analyzers Libplanet Any
Lucene.Net.Analysis.Common Lucene.Net Any
MassTransit.Analyzers MassTransit Any
MessagePackAnalyzer MessagePack Any
MessagePipe.Analyzer MessagePipe Any
Microsoft.AspNetCore.Components.Analyzers Microsoft.AspNetCore Any
Microsoft.Azure.Functions.Analyzers Microsoft.Azure.Functions Any
Microsoft.CodeAnalysis.Analyzers Microsoft.CodeAnalysis Any
Microsoft.EntityFrameworkCore.Analyzers Microsoft.EntityFrameworkCore Any
Microsoft.ServiceHub.Analyzers Microsoft.ServiceHub Any
MongoDB.Analyzer MongoDB Any
Moq.Analyzers Moq Any
NSubstitute.Analyzers.CSharp NSubstitute C#
NSubstitute.Analyzers.VisualBasic NSubstitute VB.NET
NUnit.Analyzers NUnit Any
RuntimeContracts.Analyzer RuntimeContracts Any
SerilogAnalyzer Serilog Any
xunit.analyzers xunit Any
ZeroFormatter.Analyzer ZeroFormatter Any

Compliant

<Project Sdk="Microsoft.NET.Sdk">

  <ItemGroup Label="Analyzers">
    <PackageReference Include="Microsoft.AspNetCore.Components.Analyzers" Version="*" PrivateAssets="All" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
    <PackageReference Include="Microsoft.Azure.Functions.Analyzers" Version="*" PrivateAssets="All" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
    <PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="*" PrivateAssets="All" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="*" PrivateAssets="All" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
    <PackageReference Include="MongoDB.Analyzer" Version="*" PrivateAssets="All" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
    <PackageReference Include="NUnit.Analyzers" Version="*" PrivateAssets="All" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
    <PackageReference Include="SerilogAnalyzer" Version="*" PrivateAssets="All" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
    <PackageReference Include="xunit.analyzers" Version="*" PrivateAssets="All" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
  </ItemGroup>

</Project>