Recent blog posts about T4


I came across several blog posts about T4 code generation you may find useful.

Sanjay Nagamangalam posted a T4 script for generating Entity Framework Views.

Damien Guard posted a T4 template for generating LINQ to SQL DataContext class in C# for all tables in a given SQL Server database.

New Age Solutions posted a T4 template for generating WiX source file that will install all files in a given directory. Make sure to read Rob Mensching comments at the bottom of the page about impact of regenerating component GUID values on installer’s ability to perform patches and upgrades.


Write a Comment

Take a moment to comment and tell us what you think. Some basic HTML is allowed for formatting.

Reader Comments

After long struggle fixed the issue identified by Rob. Now t4 template takes into account previously generated component guid. I tested doing major upgrades and it works!

Henry, major upgrades can be scheduled in such a way that they will not expose the Component Rules issues. To really verify, try building a patch from build to build. That tends to be where everything gets messed up with auto-generated .wxs files.