T4 References for 'MvcTextTemplateHost' an

2019-07-29 15:28发布

问题:

I'm having problems creating MVC 3 T4 template. I have cleared the "Custom Tool" property for the template as MvcTextTemplateHost not found suggests. But I cant find which reference to include.

Also I need to find reference for Microsoft.VisualStudio.Web.Mvc.Scaffolding.BuiltIn, I cant find it in the list of references.

Which references are missing?

TIA

/Lasse

回答1:

Probably the simplest way to go about this is to add the existing code templates to your project with NuGet (install-package Mvc3CodeTemplatesCSharp) and then make a copy of one of the templates or take a look at what references are included in them.



回答2:

Click on controller.tt and go to properties in "custom tool namespace" enter TextTemplatingFileGenerator. and remove from other .tt if there are TextTemplatingFileGenerator.