I've been working on this problem for a while now and I'm not sure what else to try. The error message I'm getting is this:
System.InvalidOperationException: The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Home/Index.aspx
~/Views/Home/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
~/Views/Home/Index.cshtml
~/Views/Home/Index.vbhtml
~/Views/Shared/Index.cshtml
~/Views/Shared/Index.vbhtml
The view is located at Views/Home/Index.cshtml
Here's the RouteConfig
class
public class RouteConfig {
public static void RegisterRoutes(RouteCollection routes) {
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
Even putting a breakpoint in the Index action on the Home controller doesn't trigger. The Index controller action just returns the view:
public ActionResult Index() {
return View("~/Views/Home/Index.cshtml");
}
The project settings are set to Use Local IIS Web server
Building the project succeeds. There are no build events. Target framework is .NET Framework 4.5. Output type is Class Library.
I was comparing everything I could think of with another project that is working and there's nothing standing out to me. I even compared the .csproj
files of both and the only differences seemed to be <Content Include
lines for files that are not in the other project. Any ideas on where to look next to fix this?