ASP.NET MVC Custom View Path breaks Visual Studio shortcuts

百般思念 提交于 2019-12-07 07:11:29

问题


I've seen a lot of articles on how to change the default paths for an ASP.NET MVC project so you can relocate or rename your Controllers, Models, and Views folders by extending the RazorViewEngine and specifying new path formats.

So far, this works great but the side-effect is that it has broken the Visual Studio shortcuts for "Go to View" or "Add View...".

Any ideas on whether those shortcut options can be customized to know about the new paths I've specified?

Thanks in advance! - Scott


回答1:


The Visual Studio features cannot be extended to support custom paths. However, in the ASP.NET and Web Frameworks 2012.2 update that will soon be released (you can download a preview right now from here), the Add View functionality was updated to be a lot more flexible regarding which folders will have it enabled and which won't. It now supports Add View in any folder that is anywhere under a folder called "Views".

Regarding Go To View, that was not updated because unfortunately there is no way for the VS tooling to be aware of runtime customizations made to the view engine - I agree it would be cool, though!

(BTW my source for this information is that I work on ASP.NET MVC at Microsoft.)



来源:https://stackoverflow.com/questions/14861714/asp-net-mvc-custom-view-path-breaks-visual-studio-shortcuts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!