“.. 必须派生自 WebViewPage,或 WebViewPage<TModel>"在 MonoDevelop &MVC3 (OS X) [英] ".. must derive from WebViewPage, or WebViewPage<TModel>" on MonoDevelop & MVC3 (OS X)

查看:24
本文介绍了“.. 必须派生自 WebViewPage,或 WebViewPage<TModel>"在 MonoDevelop &MVC3 (OS X)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让一个 MVC 3 Razor 项目与 MonoDevelop 一起使用.

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

我使用 Mono 2.10.9/MonoDevelop 3.0.4.7 创建了一个新的 ASP.net MVC 2 项目,并将以下 DLL 从现有的基于 Windows 的 MVC3 项目复制到 Mono 项目的bin"目录:

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

已将项目设置为使用 Mono/.NET 4.默认索引文件已被删除并替换为 Index.cshtml 文件.当我执行项目时,出现以下错误:

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>.

奇怪的是,我之前经历过这个过程,并且 MVC 3 页面可以正常工作.只是在升级 Mono(它声称支持 Razor ......?)之后,它现在不再为我工作了.然而,我之前使用 MVC3 创建的项目似乎都可以在新的 Mono 版本中编译和运行.

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 :)

推荐答案

如果有人遇到这种情况,那只是因为位于Views"文件夹下的 web.config 文件尚未更新,因此引用了 MVC3 Razor组件.呵呵.

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.

最简单的做法是从现有的 MVC3 项目中复制一个.

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

这篇关于“.. 必须派生自 WebViewPage,或 WebViewPage&lt;TModel&gt;"在 MonoDevelop &amp;MVC3 (OS X)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆