Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error after browsing to Login page in MVC Core app #37

Closed
NRKirby opened this issue May 8, 2019 · 2 comments
Closed

Error after browsing to Login page in MVC Core app #37

NRKirby opened this issue May 8, 2019 · 2 comments

Comments

@NRKirby
Copy link

NRKirby commented May 8, 2019

I am getting the following error

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

when I browse to the Login page in a new MVC Core app

The folder structure looks like this:

image

I've added the following in ConfigureServices


            services
                .AddMvc()
                .AddFeatureFolders()
                .SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

and in Configure


app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

Can anyone help with this please? I'm not sure what I'm doing wrong here

@NRKirby NRKirby changed the title Error after adding Login and Register scaffolding in MVC Core app Error after browsing to Login page in MVC Core app May 8, 2019
@NRKirby
Copy link
Author

NRKirby commented May 8, 2019

Ok so the problem was I didn't have the correct path in _ViewStart.cshtml, I needed to update that to:

/Features/Shared/_Layout.cshtml

@NRKirby NRKirby closed this as completed May 8, 2019
@OdeToCode
Copy link
Owner

Glad you could figure that out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants