4
votes

I have this ASP.NET MVC 3 application that works fine when developing locally using IIs Express 7.5 or Cassini.
But when i deploy the app to a real web site on IIs 7.5 (even on my local dev box) I get the dreaded

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.cshtml
~/Views/Home/Index.vbhtml
~/Views/Shared/Index.cshtml
~/Views/Shared/Index.vbhtml

I have tried the following: In global.asax.cs, added these lines in the Application_Start() method to force it to use the Razor view engine only:

ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RazorViewEngine());

But to no avail.
I find this error message somewhat difficult to troubleshoot. Can someone give me some pointers on what to look for?

1

1 Answers

2
votes

Ok, my bad.

A classic example of shooting first then ask. (Or the other way around...)

The Home/Index.cshtml file had its Build Actions set to None for some reason. Setting it to Content solved the problem.