-
Notifications
You must be signed in to change notification settings - Fork 25.3k
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
The view 'Index' was not found #25157
Comments
That's a really good error message. |
InvalidOperationException: The view 'Index' was not found. The following locations were searched: /Views/Home/Index.cshtml /Views/Shared/Index.cshtml |
Really good error message. |
i solved cmd - dotnet watch run :) |
So what did you do wrong?
|
So I didn't run a dotnet for short.🤣🤣🤣 |
Without command how we can run project vai IIS express? |
I have VS 2019 (v. 16.11.2). Just created a new ASP.NET Core Web MVC application (was targeting to net5.0 by default, but I had to specify net6.0 there). After that, I was getting the same error whenever I launched the project via standard "run IIS express". dotnet sdk version (via P.S I can't update to VS2022 as my laptop too slow for its. |
i was also facing similar issue,took long time to fix... |
Is there any resolution to this error? I am also seeing this even though it tells me it search exactly where the view is located. Endpoint
Route Values
|
I had the same issue because I manually updated my project to At some point, during building, it says that VS 2019 does not support I had to upgrade to VS 2022. |
Is there any workaround in case upgrading to VS2022 is not possible? I was trying to follow a suggestion from @Madhusudhan-V (delete existing .cshtml file and create a new one) but it didn't solve this issue. |
I was facing this issue when I upgraded my .net application to .net core 6.0
this AddRazorSupportForMvc setting helped to resolve this issue of "the-view-index-was-not-found" |
I had the same problem. `ItemGroup> -- removed ItemGroup> ItemGroup> -- removed I didn't understand why this was put in my csproject, but I removed it and it worked |
Have a try adding Nuget OR add SDK 6-7 and update VS2022 |
In my case (core 6) AreaViewLocationFormats did not work correctly. |
This works temporarily in development when you publish to a server, it comes back and the exception appears. Have you resolved this from the root? That is, installing Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation works but when publishing to ISS the error appears again, is there any definitive solution for both development and production, am I using visual 2022? |
For me this error apeared suddenly. The project launched successfully, but on the next try, “index not found.” The problem was in one of the views in the razor syntax. In another cshtml, not in the Index. I started construction '@(' but didn't close it correctly with ')'. In this state, the program compiles and runs, but cannot find its views. Check it out, it might be the same for you. In the view with an error, all html tags after the wrong '@(' will not have highlighting. |
Thanks, this resolved my case |
This one work for me. |
I just noticed when create a fresh project on VS 2022 17.8.7 I get that error, |
Yeah this is driving me up a wall.... Actually ran out of google results. And it sounds like Adding
As far as I can tell, and I've now visited nearly 47 different threads looking for answers, MVZ views just "don't work". Which doesn't seem likely, given they do actually work in example projects. But adding them to an existing project appears to be a nightmare straight out of the 5th layer of hell where where also find CakePHP, ASPNET webforms, and Coffeescript being buddy-buddy. |
Visual Studio Community 2019 for Mac
Version 8.10.19 (build 2)
1- create project Web application MVC (net 5.0)
2- upgrade to Net 6.0 (https://docs.microsoft.com/en-us/aspnet/core/migration/50-to-60?view=aspnetcore-6.0&tabs=visual-studio-mac)
3 - run
4 - Exception Error :
fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
An unhandled exception has occurred while executing the request.
System.InvalidOperationException: The view 'Index' was not found. The following locations were searched:
/Views/Home/Index.cshtml
/Views/Shared/Index.cshtml
API Working fine , Web application MVC not working
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: