Skip to content

DotNetAnalyzers/AspNetCoreAnalyzers

Repository files navigation

AspNetCoreAnalyzers

NuGet License Build Status Build status Join the chat at https://gitter.im/DotNetAnalyzers/AspNetCoreAnalyzers

Roslyn analyzers for ASP.NET.Core.

animation

Id Title
ASP001 Parameter name does not match the name specified by the route parameter
ASP002 Route parameter name does not match the method parameter name
ASP003 Parameter type does not match the type specified by the name specified by the route parameter
ASP004 Route parameter type does not match the method parameter type
ASP005 Syntax error in parameter
ASP006 Escape constraint regex
ASP007 The method has no corresponding parameter
ASP008 Invalid route parameter name
ASP009 Use kebab-cased urls
ASP010 Unexpected character in url
ASP011 Route parameter appears more than once
ASP012 Don't use [controller]
ASP013 Name the controller to match the route

Using AspNetCoreAnalyzers

The preferable way to use the analyzers is to add the nuget package AspNetCoreAnalyzers to the project(s).

The severity of individual rules may be configured using .ruleset files in Visual Studio.

Installation

AspNetCoreAnalyzers can be installed using Paket or the NuGet command line or the NuGet Package Manager in Visual Studio.

Install using the command line:

Install-Package AspNetCoreAnalyzers

Updating

The ruleset editor does not handle changes IDs well, if things get out of sync you can try:

  1. Close visual studio.
  2. Edit the ProjectName.rulset file and remove the AspNetCoreAnalyzers element.
  3. Start visual studio and add back the desired configuration.

Above is not ideal, sorry about this. Not sure if this is our bug.

Current status

Early alpha, names and IDs may change.