Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find all usages of an ASP.NET MVC View with Resharper

I don't know if I am being daft but I can't find a way of finding all usages of a View (cshtml file) with VS and Resharper. The view could be full or partial. If someone could help me out this would be useful for a new project I am working on!

like image 927
Jim Avatar asked Mar 11 '14 11:03

Jim


People also ask

Where are MVC views stored in ASP NET?

ASP.NET MVC views are stored in Views folder. Different action methods of a single controller class can render different views, so the Views folder contains a separate folder for each controller with the same name as controller, in order to accommodate multiple views.

How does ReSharper work with Visual Studio Code?

ReSharper will jump to the declaration of the corresponding type, method, field, or local variable in the relevant source file. For library symbols, the corresponding entity will be displayed in Visual Studio's Object Browser or in the editor as metadata view or decompiled code, depending on ReSharper settings.

What is Razor View in ASP NET MVC?

View is a User Interface which displays data and handles user interaction. Views folder contains separate folder for each controller. ASP.NET MVC supports Razor view engine in addition to traditional .aspx engine. Razor view files has .cshtml or .vbhtml extension.

What is the use of view method in MVC?

The View method is the endpoint of a rather sophisticated pipeline that finds, at the other end, the selected ASP.NET MVC view engine. Whenever you invoke the method View, an instance of the ViewResult class is created and returned more or less as in the code below.


1 Answers

If you have ReSharper installed:

  1. Select the View file from Solution Explorer
  2. With you keyboard, Ctrl + Shift + Alt + F12. OR, Right click on the View and select Find Usages Advanced...
    • Find Usages Advanced...
  3. This brings you a window. Select all the checkboxes from Find column, and select solution from Scope column, click Find
    • Search Properties
  4. This will bring you a list of usages, in Find result window.
    • Find Results
like image 104
Zafar Avatar answered Oct 12 '22 23:10

Zafar