Keeping ReSharper happy with switchable layouts

446 views Asked by At

In an MVC project I have a number of views that can be displayed in two "modes", where a different layout file is used for each mode.

To achieve this, I am setting the layout file using the appropriate Controller.View overload.

public ActionResult Index()
{
    return View("Index", "_IndexLayout");
}

public ActionResult Dialog()
{
    return View("Index", "_DialogLayout");
}

Both of the layout files have a @RenderSection("PageJavascript"), and the views have a @section PageJavaScript.

Here comes the tricky part: ReSharper's solution wide analysis is complaining about this, giving an error of Cannot resolve section 'PageJavaScript'.

Is there an alternative approach to layout switching I can use that will allow ReSharper to know that I am using a layout file that contains this section?

0

There are 0 answers