Asp.NET MVC 2 Preview 2:Area的aspx命名空间问题
我现在正在测试 MVC 2 Preview 2 的一项新功能,称为“一个项目中的区域”。 遵循 MSDN 文章以及我已经创建了 Areas 文件夹,然后是区域的名称文件夹,然后是其中的 Controllers 和 Views 文件夹。 当然,添加了路由类并且它可以工作。
然后我将其中一个控制器及其视图文件夹移动到该新区域。 并且它无法在第一行运行 aspx 页面:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master"
Inherits="System.Web.Mvc.ViewPage<OtherReferencedProjectNamespace.Entity>" %>
带有语法解析器消息
"Cannot load the type: OtherReferencedProjectNamespace.Entity" /example entity name here/
看起来没有对先前使用的命名空间的引用,没有任何问题!移入某个区域的代码是否具有单独的命名空间引用?
没有对项目进行任何参考更改,只是将其中一个控制器及其视图文件移动到一个区域中。
我还没有解释,你有什么想法吗?
I am now testing the new feature of MVC 2 Preview 2 called Areas within one project.
Followed the MSDN article as well as the relase notes document I have created the Areas folder, then area's name folder, then Controllers and Views folders within that.
Of course the route class was added and it works.
Then I have moved one of the controllers and it's view folder to that new area.
And it fails to run aspx page on the first line:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master"
Inherits="System.Web.Mvc.ViewPage<OtherReferencedProjectNamespace.Entity>" %>
with the syntax parser message
"Cannot load the type: OtherReferencedProjectNamespace.Entity" /example entity name here/
Looks like there are no references to namespaces used previously without any problems! Does the code moved into an area have separate namespace references?
No reference changes were made to the project, just moved one of the controllers with it's view files into an area.
I have no explanation for that yet, have you got an idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的 - 找到了!必须将 Web.config 从根 Views 目录复制到区域 Views 文件夹。
OK - found it! Had to copy Web.config from root Views directory to the area Views folder.