Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6829411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:29:50+00:00 2026-05-26T22:29:50+00:00

Does any one know a way to find out unused views in project ?

  • 0

Does any one know a way to find out unused views in project ? with Resharper or without it.
any idea which is easier than writing down all the views and go through all controllers and check manually is appreciated 🙂
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:29:51+00:00Added an answer on May 26, 2026 at 10:29 pm

    With ReSharper you can right-click a Razor view and Find Usages, but you’d have to go through manually and repeat for all views (unless you can hook into ReSharper’s API and automate it).

    The problem with views of course is that they’re late-bound based on a convention defined in the view engine, in the case of the default RazorViewEngine it looks for a corresponding view in ~/Views/{Controller}/{Action} and ~/Views/Shared/{Action}. So it’s difficult to tell at design or compile time which views, partials and templates are never used.

    You might approch it from the opposite angle: find which views are being used. Then diff this list against all views in the project, evaluate the results (manually and with ReSharper Find Usages) and confirm they’re really not being used before finally removing them.

    To find the views being used you could customise the RazorViewEngine to log every time it loads a view with CreateView and FindPartialView, e.g.

    public class LoggingRazorViewEngine : RazorViewEngine
    {
        protected override IView CreateView(
            ControllerContext controllerContext,
            string viewPath,
            string masterPath)
        {
            LogManager.GetLogger("").Debug(viewPath);
            return base.CreateView(controllerContext, viewPath, masterPath);
        }
    }
    

    Configure it in global.asax.cs

    ViewEngines.Engines.Clear();
    ViewEngines.Engines.Add(new LoggingRazorViewEngine());
    

    Then extract a list of logged unique view paths to compare against your project’s views. Bit of effort involved, but possibly worth if if you’ve got lots of unused views cluttering up the project.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know a way to find out programatically which physical disk holds a
Does any one know of a way to control how Visual Studio handles curly
Does any one know a good way to do remote procedure calls in windows
Is there a way in any browser to find out who (which piece of
Is there a way I can find out if there are more than one
This one is pretty out there, but I can't find any posts addressing it
Does anyone know a way to auto-generate database tables for a given class? I'm
does anyone know a way to call a generic method of a base class
Does anyone know a way to open up an instance of the operating system
Does anyone know a way to open a 2nd form in a .NET application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.