I am using T4 to generate some screens and middle-tier code for a project, and would like to use Linq to simplify some of my template code. However, when I try to use Linq, the template reports a syntax error.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
By default in Visual Studio 2008 (and as used in most online examples) the template is compiled with the 2.0 Framework, which does not include Linq. (See MSDN forum thread)
To solve the problem, three steps are needed:
Your template will now look something like this:
You can now use Linq and other new language features in your template.