Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I get intellisense in a T4 template?

When trying out these tutorials (T4 Tutorial: Creating reusable code generation templates) I noticed that although I was using plain c# I didn't get any intellisense, probably because of the file extension (.tt)

Isn't there anyway to say to Visual Studio to consider those .tt files as .cs files and thus get the correct intellisense help?

like image 520
Vitor Silva Avatar asked Jan 07 '09 15:01

Vitor Silva


People also ask

What is the purpose of using T4 templates?

Design-time T4 text templates let you generate program code and other files in your Visual Studio project. Typically, you write the templates so that they vary the code that they generate according to data from a model. A model is a file or database that contains key information about your application's requirements.

What is true about T4 templates in Entity Framework?

T4 templates in entity framework are used to generate C# or VB entity classes from EDMX files. Visual Studio 2013 or 2012 provides two templates- EntityObject Generator and DBContext Generator for creating C# or VB entity classes. The additional templates are also available for download.

How do I add a .TT file to Visual Studio?

Include the file into your Visual Studio project. In Solution Explorer, on the shortcut menu of the project, choose Add > Existing Item. Set the file's Custom Tools property to TextTemplatingFilePreprocessor. In Solution Explorer, on the shortcut menu of the file, choose Properties.


1 Answers

Resharper can do this, with the help of the ForTea Plugin that adds support for editing T4 (.tt) files.

like image 192
Dan Avatar answered Sep 19 '22 13:09

Dan