How to do it...

  1. Add a new project to your Visual Studio solution and click on Extensibility and select the Analyzer with Code Fix (NuGet + VSIX) template. Give it a suitable name and click on OK to create the Analyzer project.
  1. You will see that Visual Studio has created three projects for you: Portable, .Test and .Vsix . Ensure that the .Vsix project is set as the default startup project.
  1. In the Portable class, take a look at the DiagnosticAnalyzer.cs file. You will see a method called AnalyzeSymbol(). All that this code analyzer does ...

Get C# 7 and .NET Core 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.