views:

718

answers:

3

When I'm adding a new strongly-typed view to an ASP.NET MVC project, I can select between different view content templates (Create Details, Edit, List). I have read these are templates based on the Visual Studio T4 code generation engine.

How can I author and configure my own templates and let them appear in the available templates when adding a new view?

+6  A: 

good starting point

Another one

Fredou
+1  A: 

You might want to take a look at David Hayden's site: http://www.pnpguidance.net/Tag/T4.aspx -- He offers several screencasts on T4 and MVC that got me started. Also take a look at the T4 toolbox: (www.codeplex.com/t4toolbox). This provides additonal helpers for T4 templates.

Skelly
thanks for the link, I will have a look at it.
kay.herzam
+2  A: 

Create following folder structure:

{YourMVCProject}\CodeTemplates\AddView

Put your custom T4 templates (*.tt) in this folder. You will see the magic!

Tri
Thanks. Meanwhile I figured that out.
kay.herzam