简体   繁体   中英

How do I tell Resharper to look in a custom location for Partial views?

I have set up a project that has a custom ViewEngine that changes the traditional locations that Partials can be located. Previously, Resharper would let me F12 into my partial views, but that no longer works because Resharper thinks they don't exist even though they do. Can I do something to let Resharper know where to look for these files?

I have Resharper 8.2 installed. I would register custom ViewEngine in global.asax and it works fine.

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 code snip 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;
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM