Question

I use MVC4 with mono 3.2.3 and I notice that if I create an error in Razor cshtml file:

@for(int i = 0; i < 8aaaa; i++)

Following error occurs:

System.InvalidOperationException
The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched: ...

I remember that on Windows there's a smart Razor compilation error message. How could I enable such feature under mono platform?

Related question: MVC5 Autofac: The view found at was not created

Was it helpful?

Solution

In Windows, the Razor files are compiled individually and maybe with better support for design type error checking.

With the Mono runtime of .NET, all views are group compiled by controller and even with 1 Razor syntax error, none of the views under that Controller will be compiled. This means the views really don't exist and they throw the "view not found" error.

I doubt if there is any setting which can get the behavior like on Windows with the .NET runtime.

OTHER TIPS

Add below lines in .csproj file.It will compile views

<PropertyGroup>
    <MvcBuildViews>true</MvcBuildViews>
</PropertyGroup>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top