问题描述
我已经从MSDN本指南中关于以下创建一个ASP.NET MVC应用领域中使用多个项目。因为ASP.NET MVC 2.0刚刚preVIEW人会想到那里是一些bug。
I've been following this guide from MSDN about "Creating an ASP.NET MVC Areas Application Using Multiple Projects". Since ASP.NET MVC 2.0 is just preview one would imagine there to be some bugs.
我的问题是,它根本不起作用!它的猜想至少没有办法的办法。设置的一切行动和pressing F5后,人们可能会认为,这将工作,利落! BEEEP。错了。
My problem is, it simply doesn't work! At least not the way it's suppose to. After setting everything up and pressing F5, one would think that, this will work, neat! BEEEP. Wrong.
它不会发现,在子项目的意见!因为在我的情况下,它会尝试在〜/浏览次数
这当然是在父!
It doesn't find the Views in the child project! Because in my case it tries to search within ~/Views
which of course is in the parent!
在调试我看到它是否运行控制器在我的孩子的项目,但在使用返回查看();
上的行动,它看起来父视图 - 内文件夹。
When debugging i see that it Does run the Controller inside my child project, but when using return View();
on that Action, it looks inside the Parent View-folders.
我问,错误或意见?
试过这两个Vs2009,VS2010与两个框架3.5和4.0。
Tried this in both Vs2009, Vs2010 with both Framework 3.5 and 4.0.
推荐答案
我把谷歌的多项目区域,来到翻过这篇文章:的。注意具体菲尔哈克的响应。
I put "multi project areas" in Google and came accross this post: http://forums.asp.net/p/1494640/3540105.aspx. Note specifically Phil Haack's response.
看来,定义在父项目的意见是按设计,因为在MSDN后本条目:现在所有的code是到位,最后一步就是为每个区域项目自定义生成过程。这种定制导致一些儿童区域中的文件,如意见,要复制到应用程序的构建之前,主体工程。
It appears that defining your views in the parent project is "functioning as designed" because of this entry in the MSDN post: Now that all the code is in place, the final step is to customize the build process for each area project. This customization causes some child-area files, such as the views, to be copied to the main project before the application is built.
问题的帖子是,它被定义为测试版,其中该生成步骤是容易accessable。 RC +你必须指向期货组装和略有不同,如果这是你选择的路径分配的生成步骤。
The "problem" with the post is that it was defined for the beta where this build step was easily accessable. RC+ you have to point to the Futures assembly and assign the build step slightly differently if this is the path you choose.
如果你不喜欢这会使你的方向,MvcContrib菲尔的便携式地区部分提到的一样好你会得到一个替代。
If you don't like the direction this pushes you, the portable areas portion of MvcContrib Phil mentions is about as good as you're gonna get to an alternative.
这篇关于地区在多个项目 - 视图的子项目未发现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!