开发者

Problem using Razor after migrating MVC 2.0 to MVC 3.0 RC

开发者 https://www.devze.com 2023-01-24 15:40 出处:网络
I migrated a MVC 2.0 site to MVC 3.0, using that : Migrating MVC 2.0 -> 3.0 Using ASPX as V开发者_Go百科iew Engine works great now...

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

Using ASPX as V开发者_Go百科iew 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


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


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.

0

精彩评论

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

关注公众号