尝试使用 MVCScaffolding 创建视图时出现问题
注意:我已查看此链接并禁用了 CustomTools,但仍然收到此错误: MvcTextTemplateHost not found
我是尝试在一个命令中为创建、更新、详细信息、过滤器和列表操作创建自定义视图。我可以通过右键单击并选择“新视图”一次添加它们,但是当我输入 Scaffold AddView SampleModel 时,我收到以下错误消息:
无法找到类型或命名空间名称“MvcTextTemplateHost”(是否缺少使用指令还是程序集引用?)。
模板文件是AddView.cs.t4。我尝试将其重命名为 .tt 但无法让 Powershell 查找 .tt 文件。有什么想法吗?
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 or 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MvcScaffolding 使用自己的自定义模板宿主,不使用 MvcTextTemplateHost。我会看一下 MvcScaffolding NuGet 包 中包含的 T4 模板。这些模板之一的开头如下所示。
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.