Problem using Razor after migrating MVC 2.0 to MVC 3.0 RC

↘锁芯ラ 提交于 2019-12-21 19:56:55

问题


I migrated a MVC 2.0 site to MVC 3.0, using that : Migrating MVC 2.0 -> 3.0

Using ASPX as View Engine works great now...

But I tried to create a Razor view and got that error:

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

How can I enable razor on that?

I´m using Visual Studio 2010... Creating a brand new MVC 3 Web Application enables Razor fine!

Thanks


回答1:


Try adding ViewEngines.Engines.Add(new RazorViewEngine()); to your global.asax file




回答2:


Please review

In Solution Explorer, delete the reference to System.Web.Mvc (which points to the version 2 DLL). Then add a reference to System.Web.Mvc (v3.0.0.0). Also add a reference to System.WebPages.dll and System.Web.Helpers.dll.



来源:https://stackoverflow.com/questions/4146429/problem-using-razor-after-migrating-mvc-2-0-to-mvc-3-0-rc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!