Skip to content

JetBrains Rider

Simon Hughes edited this page Sep 7, 2026 · 1 revision

JetBrains Rider

The generator runs in Rider and produces the same code it produces in Visual Studio. Rider's T4 support runs the template; the efrpg tool reads the database; nothing in the include depends on Visual Studio. What you do not get is the extension: there is no item template, no connection dialog, no object picker, no settings editor and no v3 upgrade command. You add two files by hand and run the template from the context menu.

Verified on Windows. The efrpg tool itself is cross-platform, but running the template on macOS or Linux has not been tested.

Setup

  1. Install the efrpg tool once per machine. It needs the .NET 10 runtime.

    dotnet tool install -g Efrpg
    

    Check it is on your PATH with efrpg --help, then restart Rider so it picks up the new PATH.

  2. Add the two template files to your project, in the same folder:

    Rename Database.tt to whatever you like. If you already use the generator in Visual Studio, copy the same two files from that project; they are identical.

  3. Set the connection string and any settings in the .tt, exactly as in Visual Studio. See Connection strings.

  4. Run the template: right-click the .tt file and run it from the T4 context menu. Rider writes the .cs beside it. Re-run whenever the database changes; saving the file does not regenerate in Rider the way it does in Visual Studio.

Differences from Visual Studio

  • One blank line at the top of the output. Rider writes the line break that follows the <#@ include #> line in your .tt; Visual Studio drops it. The generated code is otherwise identical, and the template cannot remove it because Rider writes it after the include has run. Harmless, and it disappears on the first regeneration in Visual Studio if the project is shared.
  • Namespace. Visual Studio hands the template the project's root namespace and folder path. Rider supplies nothing, so the generator reads the nearest .csproj above the template and derives the same namespace itself. Setting Settings.Namespace in the .tt overrides both.
  • Line endings. Rider writes the generated file with LF. If your repository normalises line endings this makes no difference; if it does not, expect a whole-file diff the first time the same file is generated in the other IDE.
  • Do not let Rider add using lines to the include. Rider may offer to import namespaces while you have EF.Reverse.POCO.v4.ttinclude open. Anything outside <# #> in a T4 file is copied straight into the output, so accepted imports appear as stray using lines at the top of every generated file. Keep the include as shipped; it is regenerated on every upgrade in any case.
  • Stale copies. Rider caches parsed templates. If it reports a compile error that does not match the file on disk after you replace the include, use File → Reload All from Disk and, failing that, File → Invalidate Caches.

Upgrading from v3

The v3 include has the Visual Studio dependencies that v4 removed, so v3 never worked in Rider. Follow Upgrading from v3 to v4 by hand; the right-click upgrade command is part of the Visual Studio extension.

Clone this wiki locally