Getting Started with Roslyn Analyzers

Note

This article applies to Visual Studio 2015. If you're looking for Visual Studio 2017 documentation, use the version selector at the top left. We recommend upgrading to Visual Studio 2017. Download it here.

The latest version of this topic can be found at Getting Started with Roslyn Analyzers.

With live, project-based code analyzers in Visual Studio, API authors can ship domain-specific code analysis as part of their NuGet packages. Because these analyzers are powered by the .NET Compiler Platform (code-named “Roslyn”), they can produce warnings in your code as you type even before you’ve finished the line (no more waiting to build your code to discover issues). Analyzers can also surface an automatic code fix through the Visual Studio light bulb prompt to let you clean up your code immediately

Getting Started

Roslyn Live Code Analyzers Introduction and Walkthrough

Adding Code Fixes Walkthrough: Provide Users Fixes for Analyzer Issues

Introduction and Walkthrough of Real World Analyzer Talk

Real World Roslyn Analyzer that you can also watch as a talk

Several examples on github, grouped into three kinds of analyzers

Introduction and Tour of a Few Analyzers Talk

Other Resources

More docs on the github OSS site

FxCop rules implemented with Roslyn analyzers on github