7
votes

I was insterested in Razor 2.0's condition attributes feature, so I tried to port Razor 2.0 to my MVC3 apps. I followed this link and successfully run my simple app (with one HomeController, one Index action and one *~/Views/Home/Index.cshtml view) on Windows with ASP.NET.

But when I deployed my app on mono runtime on Ubuntu, it fails to run and continues to report an error of Cannot find view:

Server Error in '/' Application The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched: ~/Views/Home/Index.aspx ~/Views/Home/Index.ascx ~/Views/Shared/Index.aspx ~/Views/Shared/Index.ascx ~/Views/Home/Index.cshtml ~/Views/Home/Index.vbhtml ~/Views/Shared/Index.cshtml ~/Views/Shared/Index.vbhtml

I googled for this error, most of the articles says it is a problem of view compiling, so I thought it is caused by mono cannot properly use the new Razor engine's compiler to compile Index.cshtml.

I then switched my app back to Razor 1.0 and everythings works fine under mono, so is it really a problem that mono cannot run Razor 2.0? or is there any quick solution to this problem?

Thanks

1
Which version of mono? You may try the trunk as it contains the open sourced official ASP.NET code: tirania.org/blog/archive/2012/Mar-28.htmlkonrad.kruczynski
Thanks for advice, I'm currently using mono 2.10 installed from the apt-get command line of Ubuntu, I may take a look at the trunk source. However razor2.0 itself is a beta version of ASP.NET, I'm wondering if it is possible to port at the source level, anyway this is a good change, thanks.otakustay
Seems like it works for Mono 2.10.2+ See: stackoverflow.com/questions/4239645/…HoBa

1 Answers

4
votes

Razor pages worked with Mono, in theory, with version 2.10.x series, but you had to bundle Microsoft's assemblies with it into your Linux box.

Since Mono 2.11.1, these assemblies are now bundled by default in Mono, because Microsoft open sourced Razor recently (on March 2012).

Hence, if I were you I would try Mono 2.11.3 to see if the problem is already fixed upstream. If not, please file a bug in http://bugzilla.xamarin.com/ with a standalone testcase to reproduce it, and link to the bug from here.