How to do it...

  1. Start Visual Studio, click on File | New | Project..., create a new C# class library project, and replace the code in Class1.cs with code from the code sample at ClassLibrary/Class1.cs (also mentioned in the Introduction section of this recipe).
  2. Install the Roslyn.Diagnostics.Analyzers NuGet package Version 1.2.0-beta2. For guidance on how to search for and install the analyzer NuGet package in a project, refer to the recipe Searching and installing analyzers through the NuGet package manager, in Chapter 2, Consuming Diagnostic Analyzers in .NET Projects.

 

  1. Escalate the severity of RS0016 and RS0017 from Warning to Error. For guidance on analyzer severity configuration, refer to the recipe, Viewing and configuring analyzers ...

Get Roslyn Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.