Vivendi
Vivendi

Reputation: 21007

MVC4 can't find shared layout page

I have an MVC4 web application that i'm adjusting. Currently a controller loads Index.cshtml. In that file i have the following line:

@{
    Layout = "~/Views/Shared/_Layout-DoubleColumn.cshtml";
}

So i changed that line to:

@{
    Layout = "~/Views/Shared/_Layout-TripleColumn.cshtml";
}

I also copied to _Layout-DoubleColumn.cshtml file and renamed that to _Layout-TripleColumn.cshtml.

Now when i run the application i get the following error message:

The layout page "~/Views/Shared/_Layout-TripleColumn.cshtml" could not be found at the following path: "~/Views/Shared/_Layout-TripleColumn.cshtml"

I have no clue what the problem could be, because i'm sure that the file is in the Shared folder...

enter image description here

Anyone any idea what the problem could be?

Upvotes: 2

Views: 4996

Answers (1)

CodeCaster
CodeCaster

Reputation: 151584

Make sure the Build Action of the file is set to Content in the properties of the View.

Upvotes: 3

Related Questions