Skip to content

Settings.UseResharper

Simon Hughes edited this page Sep 6, 2026 · 2 revisions

Settings.UseResharper

Adds // ReSharper disable All to the top of each generated file, so ReSharper stops inspecting code you did not write.

Type bool
Default true in the shipped Database.tt
Applies to EF 6 and EF Core
Databases All
In Database.tt? Yes

The Settings class field initialiser is false, but the shipped Database.tt assigns true, and the .tt is the line that runs. If you have never touched this setting, it is on.

What it does

One line, immediately after the <auto-generated> marker:

// <auto-generated>
// ReSharper disable All
using Microsoft.Data.SqlClient;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

ReSharper - and Rider, which shares the engine - stops all inspections for the rest of the file.

Generated code trips a lot of inspections that are perfectly reasonable rules for hand-written code and meaningless here: redundant qualifiers, properties that could be made read-only, virtual members in a non-sealed class, naming that follows the database rather than your conventions. None of them are actionable, because the file is regenerated.

When to use it

Leave it on if anyone on the team uses ReSharper or Rider. It costs one line and removes a permanent column of yellow from a file nobody will fix.

Turn it off if nobody does. The comment is inert without the tool, so it is one line of noise.

Turn it off if you deliberately want the inspections - occasionally useful when you are editing the templates in EF.Reverse.POCO.v4.ttinclude and want to see what the output trips.

Gotchas

disable All is a blunt instrument, deliberately. It suppresses everything for the whole file with no matching restore. That is right for generated code and would be wrong anywhere else.

It does nothing about compiler warnings. ReSharper inspections and Roslyn warnings are different things. For the compiler's "missing XML comment", see Settings.UsePragma.

Rider honours it; the dotnet build command line does not care either way. If your CI fails on warnings, this setting is not what will fix it.

Turning it on does not stop ReSharper reformatting the file if you have "reformat on save" enabled and you open the generated file. Nothing here prevents that; do not edit generated files.

See also

Clone this wiki locally