开发者

Trying to use MVCScaffolding to create Views with problems

开发者 https://www.devze.com 2023-04-08 07:38 出处:网络
NOTE: I have looked at this link and disabled CustomTools and still receive this error: MvcTextTemplateHost not found

NOTE: I have looked at this link and disabled CustomTools and still receive this error: MvcTextTemplateHost not found

I am trying to create custom Views in one command for Create, Update, Details, Filter, and List operations. I am able to add them one at a time by right clicking and choosing New View, but when I type Scaffold AddView SampleModel I get the following error message:

The type or namespace name 'MvcTextTemplateHost' could not be found (are you missing a using directive o开发者_如何学JAVAr an assembly reference?).

The template file is AddView.cs.t4. I tried renaming it to .tt but I cannot get the Powershell to look for a .tt file. Any ideas?


MvcScaffolding uses its own custom template host and does not use the MvcTextTemplateHost. I would take a look at the T4 templates that are included with the MvcScaffolding NuGet package. The beginning of one of these templates is shown below.

<#@ Template Language="C#" HostSpecific="True" Inherits="DynamicTransform" #>
<#@ Output extension="aspx" #>
<# var viewDataType = (EnvDTE.CodeType) Model.ViewDataType; #>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号