共用方式為


Install third-party 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

Visual Studio includes a core set of .NET Compiler Platform (Roslyn) analyzers. These analyzers are always on. You can install additional analyzers either as NuGet packages, or as Visual Studio extensions in VSIX files.

To install NuGet analyzer packages

  1. Find the analyzer package you want to install on www.nuget.org.

    For example, you may want to install StyleCop.Analyzers to look for style issues in your codebase.

  2. Install the package in Visual Studio, using either the Package Manager Console or the Package Manager UI.

    Note

    The www.nuget.org page for each analyzer package shows you the command to paste into the Package Manager Console. There's even a handy button to copy the text to the clipboard.

    The analyzer assemblies are installed and appear in Solution Explorer under References > Analyzers.

To install VSIX analyzers

  1. In Visual Studio, select Tools > Extensions and Updates.

    The Extensions and Updates dialog box opens.

    Note

    Alternatively, you can find and download the analyzer extension directly from Visual Studio Marketplace.

  1. Expand Online in the left pane, and then select Visual Studio Marketplace.

  2. In the search box, type the name of the analyzer extension you want to install.

  3. Select Download.

    The extension is downloaded.

  4. Select OK to close the dialog box, and then close all instances of Visual Studio to launch the VSIX Installer.

    The VSIX Installer dialog box opens.

    VSIX installer for Microsoft Code Analysis

  5. Select Modify to start the installation.

  6. After a minute or two, the installation completes. Select Close.

  7. Open Visual Studio again.

If you want to check whether the extension is installed, select Tools > Extensions and Updates. In the Extensions and Updates dialog box, select the Installed category on the left, and then search for the extension by name.

Next steps

See also