The layout view '~/Views/Shared/_Layout.cshtml' could not be located

14.8k Views Asked by At

The below image shows the project structure I am working on:

enter image description here

Inside Areas -> Billing -> Views -> _viewstart.cshtml, I have specified the path to the layout which I want to apply to the entire application but I keep getting the following error:

  • Error:

InvalidOperationException: The layout view '~/Views/Shared/_Layout.cshtml' could not be located. The following locations were searched: ~/Views/Shared/_Layout.cshtml

  • Layout Path

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

3

There are 3 best solutions below

0
Ali Sultan On BEST ANSWER

I was able to find a solution to my issue, by moving the layout to the root folder as shown in the below image:

enter image description here

0
MiMenda On

Check this:

  1. Go to _Layout.cshtml properties
  2. Build action must be equal to Content
1
Development On

missing @RenderSection("scripts", required: false)