Skip to content

Latest commit

 

History

History
77 lines (49 loc) · 4.14 KB

File metadata and controls

77 lines (49 loc) · 4.14 KB
title Disable source code analysis for .NET
description Learn how to disable the Visual Studio source code analysis feature in .NET Core, .NET Standard, .NET 5+, and .NET Framework projects.
author mikadumont
ms.author midumont
ms.subservice code-analysis
ms.topic how-to
helpviewer_keywords
code analysis, disable
disable code analysis
ms.date 04/21/2026

Disable source code analysis for .NET

Visual Studio allows you to control whether source code analyzers run at build time and design time. There are limitations to what you can disable, and the procedure for turning off code analysis differs depending on a few factors:

  • Project type (.NET Core, .NET Standard, and .NET 5+ versus .NET Framework)

    .NET Core, .NET Standard, and .NET 5+ projects have options on their Code Analysis properties page that let you turn off code analysis from analyzers installed as a NuGet package. For more information, see .NET Core, .NET Standard, and .NET 5+ projects. In contrast, .NET Framework projects require that you set properties in the project file. To turn off source code analysis for .NET Framework projects, see .NET Framework projects.

  • Source analysis versus legacy analysis

    This article applies to source code analysis and not to legacy (binary) analysis. For information about disabling legacy analysis, see Enable and disable binary code analysis for managed code.

.NET Core, .NET Standard, and .NET 5+ projects

Visual Studio 2022 version 17.0.4 and later provides two checkboxes in the Code Analysis properties page to control whether analyzers run at build time and design time. To disable code analysis in your project, follow these steps:

  1. Right-click the project node in Solution Explorer and, then select Properties.

  2. Select Code Analysis.

    The Code Analysis properties page opens.

    ::: moniker range="visualstudio" Screenshot that shows the Code Analysis properties page. ::: moniker-end

    ::: moniker range="vs-2022" Screenshot that shows the Code Analysis properties page. ::: moniker-end

  3. To disable source analysis at build time, under Run on build, clear Always run code analysis on build.

  4. To disable live source analysis, under Run on live analysis, clear Run code analysis live in the editor as you type.

Note

Starting in Visual Studio 2022 version 17.0.4, if you prefer the on-demand code analysis execution workflow, you can disable analyzer execution during live analysis. Or, you can build and manually trigger code analysis once on a project or a solution on demand. For information about running code analysis manually, see Run code analysis manually for .NET.

.NET Framework projects

To turn off source code analysis for analyzers, add one or more of the following MSBuild properties to the project file.

MSBuild property Description Default
RunAnalyzersDuringBuild Controls whether analyzers run at build time. true
RunAnalyzersDuringLiveAnalysis Controls whether analyzers analyze code live at design time. true
RunAnalyzers Setting this property to false disables analyzers at both build and design time. It takes precedence over RunAnalyzersDuringBuild and RunAnalyzersDuringLiveAnalysis. true

For example:

<RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
<RunAnalyzersDuringLiveAnalysis>false</RunAnalyzersDuringLiveAnalysis>
<RunAnalyzers>false</RunAnalyzers>

Related content