How do I tell Resharper to look at a custom location for partial views?

I created a project with a custom ViewEngine that changes the traditional locations in which Partials can be located. Resharper used to let me F12 into my partial views, but that no longer works because Resharper thinks they don't exist, even if they do. Can I do something so Resharper knows where to look for these files?

+4
source share
1 answer

I have Resharper 8.2 installed. I would register a user ViewEngineat global.asaxand it works great.

protected void Application_Start()
{
    //register custom ViewEngine
    ViewEngines.Engines.Clear();
    ViewEngines.Engines.Add(new MyCustonViewEngine());

    AreaRegistration.RegisterAllAreas();
    GlobalConfiguration.Configure(WebApiConfig.Register);
    FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
    RouteConfig.RegisterRoutes(RouteTable.Routes);
    BundleConfig.RegisterBundles(BundleTable.Bundles);
}

and here is the snippet code for MyCustonViewEngine:

public class MyCustonViewEngine : RazorViewEngine
{
    public MyCustonViewEngine()
    {
        ViewLocationFormats = new[]
        {
            "~/UI/MVC/Razor/{1}/{0}.cshtml",
            "~/UI/MVC/Razor/Shared/{1}/{0}.cshtml"
        };
        MasterLocationFormats = ViewLocationFormats;
        PartialViewLocationFormats = ViewLocationFormats;
    }
}
+5
source

All Articles