in

Chennai .Net User Group

A platform that enables you to Learn, Share & Grow (India's first .Net user group)

Shiju Varghese's Blog

Using .Net 3.5 and C# 3.0 features in T4 templates

The T4 templates are compiled against .Net Framework 2.0 by default and that will be restricted to use LINQ and other .Net 3.5 features in your T4 templates.  If you want to use any of C# 3.0 or .Net 3.5 features in your T4 templates, you have to specify T4 templates language attribute is C#v3.5 instead of C#. The .Net 3.5 features are using System.Core namespace so that you have to give reference to System.Core namespace in the T4 templates.

The below is the syntax

    1 <#@ template language="C#v3.5" hostspecific="True" #>

    2 <#@ assembly name="System.Core" #>


 

Read the complete post at http://feedproxy.google.com/~r/ShijuVBlog/~3/OXnJX2PkcyU/using-net-3-5-and-c-3-0-features-in-t4-templates.aspx

Only published comments... Jun 03 2009, 03:12 PM by Shiju Varghese's Blog
Filed under: ,
Copyright © 2002-2008 Chennai .Net User Group. All Rights Reserved. Microsoft and Microsoft logo's are trademarks of Microsoft Corporation