Delen via


Get started with Roslyn analyzers

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

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.

Get started

Roslyn analyzers overview

Tutorial: Write your first analyzer and code fix

Add code fixes Walkthrough: Provide users fixes for analyzer issues

Real world Roslyn analyzer

Several examples on GitHub, grouped into three kinds of analyzers

See also