T4MVC 和 Reshaper 导航
我经常使用 Resharper 的“转到声明”(Resharper 默认键映射中的 ctrl + b)键盘快捷键来帮助在 VS2010 中进行导航。在我的应用程序中包含对 T4MVC 的引用之前,我会使用“字符串引用”,Resharper 会知道我“想要”去哪里。
例如:
@Html.Partial("_Continents" )
当我在字符串 "_Continents"
上使用 ctrl+b 时,Resharper 知道我想要转到名为 _Continents.cshtml 的部分视图。
由于我已经开始使用 T4MVC,因此可以编写上面相同的代码片段:
@Html.Partial( MVC.CascadingDropDownLists.DropDownAjaxPost.Views._Continents )
当我在 _Continents
上使用 ctrl+b 时,它不会将我带到部分视图,而是将我带到 T4MVC 生成的代码。
有什么方法可以在项目中保留 T4MVC(我真的很喜欢强类型的感觉和智能感知支持),同时恢复原始导航?
I frequently use Resharper's 'Go to Declaration' (ctrl + b in the Resharper Default Keymapping) keyboard shortcut to help with navigation within VS2010. Before I included a reference to T4MVC in my application, I would use "string refrences" and Resharper would know where I 'meant' to go.
For example:
@Html.Partial("_Continents" )
When I would use ctrl+b on the string "_Continents"
, Resharper knew I wanted to go to the partial view named _Continents.cshtml.
Since I have started using T4MVC, the same snippet above could be written:
@Html.Partial( MVC.CascadingDropDownLists.DropDownAjaxPost.Views._Continents )
When I use ctrl+b on _Continents
, instead of taking me to the partial view, it takes me to the T4MVC generated code.
Is there any way to keep T4MVC in the project (I really like the strongly typed feel and intellisense support), while restoring the original navigation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不幸的是,ReSharper 的 MVC 导航仅适用于常量。
如果 T4MVC 将生成常量而不是只读字段 - 它应该可以工作。
Unfortunately, ReSharper's MVC navigation works only on constants.
If T4MVC will generate consts instead of readonly fields - it should works.
我创建了一个小的 Visual Studio 宏来帮助解决这个问题。它有问题,但在我看来总比没有好得多。它取代了 F12,因此您不必为每个功能使用单独的功能。
我已将其发布在这里:
用于导航到 T4MVC 链接的 Visual Studio 宏< /a>
I created a small Visual Studio macro to help with this. It has issues, but it is far better than nothing IMO. It replaces F12, so you don't have to use a separate function for each.
I've posted it here:
Visual Studio macro to navigate to T4MVC link