简体   繁体   中英

MVC: Get Intellisense in T4 Templates for own Controllers and function

In T4 Templates, i can get Intellisense when typing string.

串

How can I get this support for my own controller and functions, eg typing myClass. doesnt work.

Here's a way to get intellisense for the C# blocks in your template files.

https://github.com/kingces95/T4Isense/tree/master

Basically, it uses an include to pull in a .cs file that has been commented and #defined so that it can be included in a template but also parsed by VS to provide coloring and isense. It's simplest to clone the project and play with it to see how it works.

This approach does require all the C# be pulled out of the template into a <#+ ... #> block but the upside is the isense is provided by VS so it's as good as it gets.

So far this editor gives me complete intellisense supprot in T4-Templates: Visulal T4: http://visualstudiogallery.msdn.microsoft.com/40a887aa-f3be-40ec-a85d-37044b239591

Same for the tangible T4 Editor, but only in the PRO Edition: http://t4-editor.tangible-engineering.com/T4-Editor-Visual-T4-Editing.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM