【发布时间】:2010-11-10 16:06:00
【问题描述】:
我将一个 MVC 2.0 站点迁移到 MVC 3.0,使用它:Migrating MVC 2.0 -> 3.0
现在使用 ASPX 作为视图引擎效果很好......
但我尝试创建 Razor 视图并收到该错误:
The view 'TestView' or its master was not found. The following locations were searched:
~/TestView.aspx
~/TestView.ascx
~/Views/Color/TestView.aspx
~/Views/Color/TestView.ascx
~/Views/Shared/TestView.aspx
~/Views/Shared/TestView.ascx
如何启用剃须刀?
我正在使用 Visual Studio 2010... 创建一个全新的 MVC 3 Web 应用程序可以很好地启用 Razor!
谢谢
【问题讨论】:
-
尝试将
ViewEngines.Engines.Add(new RazorViewEngine());添加到您的 global.asax 文件中 -
就是这样!工作得很好......发布那个答案,所以我可以接受!谢谢
标签: razor asp.net-mvc-3