-
Notifications
You must be signed in to change notification settings - Fork 226
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.
-
Install the
efrpgtool once per machine. It needs the .NET 10 runtime.dotnet tool install -g EfrpgCheck it is on your
PATHwithefrpg --help, then restart Rider so it picks up the newPATH. -
Add the two template files to your project, in the same folder:
Rename
Database.ttto whatever you like. If you already use the generator in Visual Studio, copy the same two files from that project; they are identical. -
Set the connection string and any settings in the
.tt, exactly as in Visual Studio. See Connection strings. -
Run the template: right-click the
.ttfile and run it from the T4 context menu. Rider writes the.csbeside it. Re-run whenever the database changes; saving the file does not regenerate in Rider the way it does in 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
.csprojabove the template and derives the same namespace itself. SettingSettings.Namespacein the.ttoverrides 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
usinglines to the include. Rider may offer to import namespaces while you haveEF.Reverse.POCO.v4.ttincludeopen. Anything outside<# #>in a T4 file is copied straight into the output, so accepted imports appear as strayusinglines 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.
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.
- Home
- Compared with the Microsoft scaffolder
- Connection strings
- JetBrains Rider
- Upgrading from v3 to v4
- Saving .tt does nothing
- Settings A-Z - every setting, with a page each
- Common Settings Types Explained
- Settings Callbacks
- Settings runtime values and helpers
- Filtering
- Full Control Over the Generated Code
- Enum Generation from Table Data
- Owned Entities
- JSON column support
- Global Query Filters
- Extended Property Names Feature
- Partial Properties
- File-Scoped Namespaces
- Data Annotations
- Spatial Types
- HierarchyId
- RowVersion and TimeStamp columns
- Lazy Loading
- Stored proc result sets