T4MVC 和 Reshaper 导航

发布于 2025-01-05 09:09:30 字数 595 浏览 2 评论 0原文

我经常使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

笔落惊风雨 2025-01-12 09:09:30

不幸的是,ReSharper 的 MVC 导航仅适用于常量。
如果 T4MVC 将生成常量而不是只读字段 - 它应该可以工作。

Unfortunately, ReSharper's MVC navigation works only on constants.
If T4MVC will generate consts instead of readonly fields - it should works.

美人骨 2025-01-12 09:09:30

我创建了一个小的 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文