© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•11mo ago•
5 replies
Ch0pstix

✅ Modern T4 Replacement for Design Time Codegen

Hey all!
I'm currently working on a library in which I was previously using a T4 template to generate many variants (varying on generic arity) of a struct type. I'm essentially at a point where I would like to rewrite the template for easier maintainability going forward (and to support multi-file output), and was wondering if there might a better option for design time codegen. Especially since T4 seems to be stuck on Framework and the syntax highlighting is very finicky.
One option I did some looking into was utilizing raw string literals and interpolation within a C# script file and running it via
dotnet-script
dotnet-script
during a pre-build task, but alas, Rider is yet to add support for .csx files. So, without proper intellisense, diagnostics, and highlighting, it unfortunately doesn't give me a better workflow than I had using T4.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

MSBuild Condition for Design-Time and Compile-Time
C#CC# / help
14mo ago
❔ T4 Compiling transformation error
C#CC# / help
3y ago
❔ IL CodeGen for toy compiler [advice]
C#CC# / help
3y ago
T4 templates in Entity Framework
C#CC# / help
3mo ago