".. must derive from WebViewPage, or WebViewPage<TModel>" on MonoDevelop & MVC3 (OS X)

Mr Chris picture Mr Chris · Oct 19, 2012 · Viewed 34.2k times · Source

I'm trying to get an MVC 3 Razor project going with MonoDevelop.

I've created a new ASP.net MVC 2 project using Mono 2.10.9 / MonoDevelop 3.0.4.7, and copied the below DLL's from an existing Windows-based MVC3 project to the "bin" directory of the Mono project:

System.Web.Helpers.dll
System.Web.Razor.dll
System.Web.WebPages.Deployment.dll
System.Web.WebPages.dll
System.Web.WebPages.Razor.dll

Have set the project to use Mono / .NET 4. The default Index file has been deleted and replaced with an Index.cshtml file. When I execute the project I get the below error:

The view at '~/Views/Home/Index.cshtml' must derive from WebViewPage, or WebViewPage<TModel>.

What's odd is that I've been through this process before and had MVC 3 pages working. It's only since upgrading Mono (which claims to support Razor...?) that it's now no longer working for me. The projects I've created previously with MVC3 all seem to compile and function in the new Mono version however.

Much appreciated if somebody could point out where I can find some wood amongst these trees :)

Answer

Mr Chris picture Mr Chris · Oct 31, 2012

If anybody does experience this, it's simply because the web.config file which resides under the "Views" folder has not been updated so one which references the MVC3 Razor components. Duh.

Easiest thing to do is copy one from an existing MVC3 project.