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?
Unfortunately, ReSharper's MVC navigation works only on constants. If T4MVC will generate consts instead of readonly fields - it should works.
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:
来源:https://stackoverflow.com/questions/9269279/t4mvc-and-resharper-navigation