Skip to main content

How to Resolve Error "CS0422: The /incremental option is no longer supported" in C#

The Compiler Warning CS0422 is a deprecation warning. The message reads: "The /incremental option is no longer supported".

In very early versions of .NET, the /incremental compiler flag was used to tell the C# compiler to only recompile methods that had changed, attempting to speed up build times. However, modern build systems (like MSBuild and the Roslyn compiler) handle incremental compilation automatically and much more reliably using file timestamps and metadata hashing. Consequently, the explicit /incremental switch is obsolete and ignored by the compiler.

This guide explains where this flag hides in legacy projects and how to remove it to clean up your build logs.

Understanding the Warning

The C# compiler (csc.exe) evolves over time. The /incremental feature was removed because the modern build pipeline handles "Up-to-date" checks efficiently without needing a specific compiler mode.

When you see this warning, it means your build configuration is asking for a feature that no longer exists. The compiler ignores the flag and proceeds with a standard build, so your application will still compile correctly. However, keeping obsolete flags can confuse future maintainers and clutter the output window.

Scenario 1: Legacy .csproj Configuration

This is the most common cause. If you have migrated a project from a very old version of Visual Studio (e.g., VS 2005 or 2008), the project file might still contain custom compiler options.

Example of warning

Open your .csproj file in a text editor. Look for the <CompilerOptions> tag.

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>

<!-- ⛔️ Warning CS0422: The /incremental switch is deprecated. -->
<CompilerOptions>/incremental</CompilerOptions>
</PropertyGroup>
</Project>

Solution: Remove the Option

Simply delete the switch from the string.

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>

<!-- ✅ Correct: Remove the deprecated flag. -->
<!-- If the tag is empty afterwards, you can remove the tag entirely. -->
<CompilerOptions></CompilerOptions>
</PropertyGroup>
</Project>
note

Visual Studio UI: In older Visual Studio versions, there was a checkbox under Properties > Build > Advanced called "Enable incremental compilation". In modern Visual Studio, this checkbox is removed. If the setting persists, you must edit the .csproj file manually as shown above.

Scenario 2: Command Line Scripts and CI/CD

If you maintain build scripts (Batch files, PowerShell, or Makefiles) that invoke csc.exe directly, you might have hardcoded this flag years ago.

Example of warning

# ⛔️ Warning CS0422
csc.exe /target:exe /out:App.exe /incremental Program.cs

Solution: Update the Script

Remove the flag. Modern builds will perform just as fast (or faster) without it.

# ✅ Correct
csc.exe /target:exe /out:App.exe Program.cs

Conclusion

CS0422 is a reminder to clean up your build settings.

  1. Search: Look for /incremental in your .csproj files or build scripts.
  2. Delete: Remove the flag.
  3. Ignore: Understand that modern C# builds are incrementally optimized by default; you don't need to turn this feature on.