Compiling views on build in asp mvc using custom ViewEngine

249 views Asked by At

In project we have implemented custom view engine inheriting from RazorViewEngine to solve custom views locations and logic behind choosing them.

The problem is that if I enable bulding views on project build then I get erros from views that @model doesn't exists and HtmlHelpers also doesn't.

What is more intellisense on views doesn't work. I tried to fix it by adding/editing web.config in views folder, but it doesn't work.

I think problem is that compiler on build try to use default Razor view engine which cannot resolve namespaces in custom views locations.

Project is working and views works etc, but compiling views on build doesn't, because it throws errors like @model doesn't found etc.

I have this in project csproj:

...
<MvcBuildViews>true</MvcBuildViews>
...

Any idea what needs to be done to make it working again?

0

There are 0 answers