开发者

MVC 3 Add-in View attempting to resolve _ViewStart.cshtml from Add-in

开发者 https://www.devze.com 2023-01-27 20:33 出处:网络
I\'ve been scouring the Internet and learning how to enable an ASP.Net MVC 3 site to use MEF.The idea being to build a modular site, so we can expand features as needed.I have just about every piece o

I've been scouring the Internet and learning how to enable an ASP.Net MVC 3 site to use MEF. The idea being to build a modular site, so we can expand features as needed. I have just about every piece of code 开发者_如何学编程working, but for some reason, when I'm trying to load my Index view from the Add-in, it's trying to load the _ViewStart.cshtml file from the Add-in, and not the main MVC site.

Has anyone run into this, and if so, what was the work around?


You do realize how the _ViewStart hierarchy is resolved don't you? Basically, the ViewStart closest in hierarchy to the view is given precedence for display. In your case, the viewstart in your addin is most likely to be displayed.

If you don't want that displayed, delete or remove it, and the next ViewStart up in the hierarchy will be given display precedence and it will display, be used, just like you want.

Let me know if this has been of use to you, because the way you described it, it is doing/working just like it is supposed to according to my understanding.


If you use this method: http://www.chrisvandesteeg.nl/2010/11/22/embedding-pre-compiled-razor-views-in-your-dll/ to 'embed' your views (they're actually compiled), _viewstart will first be looked for in your physical path (so your main mvc site), and if it's not found there, it'll look for the file as a compiled resource in the dll

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号